-
Domain (
Domain/): Business logic, models, use case protocols- Models: Post, Comment, User, TextSize
- Use Cases: PostUseCase, CommentUseCase, SettingsUseCase, VoteUseCase
- VotingStateProvider protocol and implementation
-
Data (
Data/): Repository implementations, API interactions- Implements Domain protocols (PostRepository → PostUseCase)
- Protocol-based UserDefaults for testability
-
Features (
Features/): UI modules with MVVM pattern- Separate Swift Package per feature (Feed, Comments, Settings, Onboarding)
- ViewModels: ObservableObject with @Published properties
- SwiftUI views with @EnvironmentObject navigation
-
Shared (
Shared/): DependencyContainer (singleton), navigation, common utilities -
DesignSystem (
DesignSystem/): Reusable UI components and styling -
Networking (
Networking/): NetworkManagerProtocol for API calls
- iOS 26+ target, Swift 6.2
- Swift concurrency (async/await)
- @MainActor for UI code
- Sendable conformance for thread safety
- ViewModels inject dependencies via protocols
- DependencyContainer.shared provides all dependencies
- Combine for reactive bindings
- @StateObject for view-owned ViewModels
- @EnvironmentObject for navigation/session state
- Swift Testing framework (
import Testing) - @Suite and @Test attributes
- Test ViewModels, not Views
- Mock dependencies with protocols
Always run xcodebuild from the project directory
# Build the app
xcodebuild -project Hackers.xcodeproj -scheme Hackers -destination 'platform=iOS Simulator,name=iPhone 17 Pro' build
# Clean and build
xcodebuild clean build -project Hackers.xcodeproj -scheme Hackers -destination 'platform=iOS Simulator,name=iPhone 17 Pro'
# Quick build status check
xcodebuild build -project Hackers.xcodeproj -scheme Hackers -destination 'platform=iOS Simulator,name=iPhone 17 Pro' 2>&1 | grep "BUILD"# Run all tests
./run_tests.sh
# Run tests for specific module
./run_tests.sh Domain
./run_tests.sh Feed
./run_tests.sh Networking- Tests are in Swift Package modules:
Domain/Tests/,Data/Tests/,Features/*/Tests/ - Each module has its own test target:
DomainTests,DesignSystemTests,DataTests, etc. - Tests use Swift Testing framework with
@Suiteand@Testattributes - Do NOT use
swift test- it runs on macOS and fails with iOS-only APIs - Tests must be run through Xcode with iOS Simulator destination
- Main Hackers.xcscheme properly configured with code coverage enabled
- Individual module schemes auto-generated by Swift Package Manager
- All tests compatible with iOS 26+ and Swift 6.2
- Do what has been asked; nothing more, nothing less
- NEVER create files unless absolutely necessary
- ALWAYS prefer editing existing files
- NEVER proactively create documentation files
- Never use
git add .- add specific relevant changes only - Commit messages should be concise and descriptive
- Never amend existing commits; always create a new commit for additional changes