| name | implement-feature |
| description | Guided Apple platform feature implementation across all layers of ProjectX Clean Architecture. Creates SwiftData models, domain entities, repositories, use cases, API requests, services, concurrency-first ViewModels, SwiftUI views, and navigation routes for Swift 6 and platform 26 targets. |
Implement Feature — ProjectX Apple Platforms
Implementation Order
Follow this exact sequence for each new feature:
Step 1: Domain Layer
Entity — ProjectX/Domain/Entities/<Name>.swift
struct EntityName: Identifiable, Equatable {
let id: String
var name: String
}
Repository Protocol — ProjectX/Domain/Repositories/<Name>RepositoryProtocol.swift
protocol EntityRepositoryProtocol {
func getAll() async throws -> [EntityName]
func getById(_ id: String) async throws -> EntityName
func create(_ entity: EntityName) async throws -> EntityName
func delete(_ id: String) async throws
}
UseCase — ProjectX/Domain/UseCases/<Name>UseCase.swift
protocol EntityUseCaseProtocol {
func execute() async throws -> [EntityName]
}
class EntityUseCase: EntityUseCaseProtocol {
private let repository: EntityRepositoryProtocol
init(repository: EntityRepositoryProtocol) { self.repository = repository }
func execute() async throws -> [EntityName] { try await repository.getAll() }
}
Step 2: Data Layer
DTO — ProjectX/Data/Network/Models/<Name>DTO.swift
- Conform to
APIResponseProtocol, Encodable, Identifiable
- Mark
@MainActor if used in UI
Request — ProjectX/Data/Network/Requests/<Name>Request.swift
- Enum conforming to
APITargetProtocol
- Cases for each CRUD operation
- Properties:
path, method, body, authentication
Service — ProjectX/Data/Network/Services/<Name>Service.swift
- Protocol + implementation using
APIClient
async throws methods
Mapper — ProjectX/Data/Mappers/Remote/<Name>Mapper.swift
- Static
toEntity(_:) and toDTO(_:) methods
Repository — ProjectX/Data/Repositories/<Name>Repository.swift
- Implements domain protocol
- Coordinates service + optional local storage
Step 3: Presentation Layer
Route — Add case to ProjectX/Presentation/Routing/Route.swift
case entityDetail
ViewModel — ProjectX/Presentation/Features/<Feature>/<Name>ViewModel.swift
@MainActor @Observable class with Action/State enums or direct async methods
- Use
send(_:), async helpers, Task, or AsyncStream when needed
- Inject use case via init
View — ProjectX/Presentation/Features/<Feature>/<Name>View.swift
- Use DS components:
DSButton, DSText, DSTextField
- Access ViewModel via
@State
- Send intents:
viewModel.intent.send(.fetchData)
RouteContentView — Add case to switch in RouterView.swift
Step 4: Wiring
AppContainer — Add factory method in ProjectX/Shared /DI/ViewModelFactory.swift
Step 5: Localization
Add keys to ProjectX/Shared /Localization/Localized/Keys/
Verify-Fix Loop
After each step group, build:
xcodebuild -scheme ProjectX -destination 'generic/platform=iOS' build
xcodebuild -scheme ProjectX -destination 'generic/platform=macOS' build
xcodebuild -scheme ProjectX -destination 'generic/platform=visionOS' build
Max 3 retries per step. Fix errors before proceeding.
Self-Review