How iplayground/iplayground-app-2025 works
Project type and purpose
• This is a modular Swift Package template for building SwiftUI apps (iOS & macOS) using The Composable Architecture (TCA).
• It cleanly separates concerns into SPM modules—Models, Features (reducers + tests), Views, DependencyClients, DependencyClientsLive—and a PublicApp “shell” that ties everything together.
• There's also an Xcode app target and a Today-style widget (NowWidget) that reuse the same package modules.
A. External Dependencies
• TCA (pointfreeco/swift-composable-architecture)
• Any other third-party SPM libraries (“Others”)
B. Local Swift Package Modules
1. Models
2. DependencyClients (protocols) → DependencyClientsLive (concrete)
3. Features (TCA reducers + state + actions) → FeaturesTests
4. Views (SwiftUI)
5. PublicApp (application entry point)
C. Xcode Targets
• iOS App (imports PublicApp)
• NowWidget Extension (imports PublicApp + WidgetClient)
Relationships & data flow
• Models → Features, Views, DependencyClients
• TCA → Features, Views (stores, reducers, scoped state)
• DependencyClients → Features (injected into environments)
• DependencyClientsLive → PublicApp & NowWidget (runtime DI)
• Features → FeaturesTests (unit-test target)
• Features + Views + DependencyClientsLive → PublicApp → iOS App & NowWidget
Architectural patterns & principles
• The Composable Architecture: each feature is a standalone reducer with scoped state, actions, and environment.
• Protocol-based DI: clients define protocols in DependencyClients; live implementations reside in DependencyClientsLive.
• Modular SPM layout: compile-time boundaries encourage independent development & TDD.
• SwiftUI previews: Views module used to iterate UI without rebuilding the full app.
Relevant technologies & frameworks
• Swift Package Manager (modular SPM targets)
• SwiftUI (all UI components)
• TCA (state management)
• XCTest (FeaturesTests, ModelsTests)
• Xcode project for app targets & widget extension