This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Swiftchan is an open-source iOS imageboard app written in SwiftUI using MVVM architecture. The app provides native webm and gif playback support through MobileVLCKit and is distributed via TestFlight.
# Install Ruby dependencies for build tools
bundle install
# Install iOS dependencies (CocoaPods)
pod install
# Open the project - ALWAYS use the workspace file
open swiftchan.xcworkspace# Run tests via Fastlane
bundle exec fastlane tests
# Build and deploy to TestFlight
bundle exec fastlane beta
# Build directly with xcodebuild
xcodebuild -workspace swiftchan.xcworkspace -scheme swiftchan -configuration Debug build# Run SwiftLint (auto-correct and check)
Pods/SwiftLint/swiftlint autocorrect && Pods/SwiftLint/swiftlint
# SwiftLint is configured in .swiftlint.yml with:
# - Line length: 1000
# - Type/identifier names: min length 1
# - Disabled: shorthand_operator# Renew certificates (requires proper auth)
make renew_certs
# Get certificates
make get_certs- Main Entry:
swiftchan/swiftchanApp.swift- SwiftUI app entry point with cache cleanup on launch - Navigation:
swiftchan/Views/ContentView.swift- Tab-based navigation with biometric authentication - State Management:
swiftchan/Environment/AppState.swift- Observable app-wide state using Swift's @Observable macro - API Layer:
swiftchan/Services/FourchanService.swift- Async/await based API service using FourChanAPI package
-
MVVM Pattern: ViewModels (
swiftchan/ViewModels/) manage business logic and state for viewsBoardsViewModel- Manages board listing with async loadingCatalogViewModel- Handles catalog/thread browsingThreadViewModel- Thread display and auto-refresh logicVLCVideoViewModel- Video playback state management
-
Media Handling: Complex media system for images, GIFs, and webm videos
- Native webm support via MobileVLCKit (CocoaPod dependency)
- Image caching with Kingfisher (Swift Package)
- Custom VLC integration in
swiftchan/Views/Media/VLC/
-
Service Layer (
swiftchan/Services/):CacheService- Media and data cachingCommentParser- Parses imageboard markupPrefetcher/VideoPrefetcher- Preloads media contentDeepLinker- URL scheme handling
-
View Organization:
Boards/- Board selection and catalog browsingMedia/- Image, GIF, and video viewing componentsUtility/- Reusable UI components (Toast, Blur, Privacy)
CocoaPods (Podfile):
- MobileVLCKit - Video playback
- SwiftLint - Code linting
Swift Package Manager (via Xcode project):
- FourChan API - Custom fork at https://github.com/vanities/FourChanAPI.git
- Kingfisher - Image caching
- ToastUI - Toast notifications
- Defaults - User preferences
- SwiftUI-Introspect - SwiftUI introspection
- ConfettiSwiftUI - Visual effects
- Unit tests in
swiftchanTests/ - UI tests in
swiftchanUITests/ - Test via Fastlane:
bundle exec fastlane tests - Tests run on iPhone 14 simulator by default
- Performance tests can be skipped in CI
- Fastlane manages TestFlight deployments
- GitHub Actions CI on pull requests (.github/workflows/build_and_test.yml)
- Automatic version bumping on beta releases
- Certificates managed via Fastlane match
- ALWAYS use
swiftchan.xcworkspace, not the.xcodeprojfile - Run SwiftLint before committing changes
- The app requires iOS 15.0 minimum
- Biometric authentication is integrated throughout the app
- Media URLs are constructed using the FourChan API package
- VLC integration requires careful handling of the MobileVLCKit pod