This document provides step-by-step instructions for adding the newly implemented TCA (The Composable Architecture) and Redux patterns to the Xcode project.
The following files have been created but are not yet added to the Xcode project:
Examples/TCA/
├── Features/
│ └── TCAAppFeature.swift
├── Models/
│ ├── TCAListItem.swift
│ └── TCASidebarCategory.swift
├── Views/
│ ├── TCAContentListView.swift
│ ├── TCAContentView.swift
│ ├── TCADetailView.swift
│ ├── TCASettingsContentView.swift
│ └── TCASidebarView.swift
└── README.md
Examples/Redux/
├── Actions/
│ └── ReduxActions.swift
├── Models/
│ ├── ReduxListItem.swift
│ └── ReduxSidebarCategory.swift
├── Reducers/
│ └── ReduxReducers.swift
├── State/
│ └── ReduxAppState.swift
├── Store/
│ └── ReduxStore.swift
├── Views/
│ ├── ReduxContentListView.swift
│ ├── ReduxContentView.swift
│ ├── ReduxDetailView.swift
│ ├── ReduxSettingsContentView.swift
│ └── ReduxSidebarView.swift
└── README.md
TCA requires the Swift Package from Point-Free:
- Open
SwiftUIExamples.xcodeprojin Xcode - Go to File > Add Package Dependencies...
- Enter the repository URL:
https://github.com/pointfreeco/swift-composable-architecture - Select version: 1.0.0 or later (recommended: latest)
- Click Add Package
- Ensure ComposableArchitecture is added to the SwiftUIExamples target
- In Xcode's Project Navigator, right-click on the
Examplesfolder - Select Add Files to "SwiftUIExamples"...
- Navigate to
Examples/TCA - Select the TCA folder
- Ensure the following options are checked:
- ✅ Copy items if needed (leave unchecked since files are already in project)
- ✅ Create groups (not "Create folder references")
- ✅ Add to targets: SwiftUIExamples
- Click Add
Important: When adding files, Xcode may warn about the README.md file. See "Resolving README Conflicts" below.
- In Xcode's Project Navigator, right-click on the
Examplesfolder - Select Add Files to "SwiftUIExamples"...
- Navigate to
Examples/Redux - Select the Redux folder
- Ensure the following options are checked:
- ✅ Copy items if needed (leave unchecked)
- ✅ Create groups
- ✅ Add to targets: SwiftUIExamples
- Click Add
The project currently has multiple README.md files in different pattern directories, which causes build conflicts:
Examples/ViewOnly/README.mdExamples/MVVM/Models/README.mdExamples/MVVM/ViewModels/README.mdExamples/MVVM/Views/README.mdExamples/MVVMC/README.mdExamples/MVVMC/Coordinators/README.mdExamples/TCA/README.mdExamples/Redux/README.md
Solution: Remove README files from the target membership:
- In Xcode's Project Navigator, select each
README.mdfile - In the File Inspector (right panel), under Target Membership
- Uncheck
SwiftUIExamples - Repeat for all README.md files
This prevents the build error: "Multiple commands produce README.md"
- Select the SwiftUIExamples scheme
- Choose a destination (Mac, iOS Simulator, etc.)
- Press ⌘B to build
- Verify no errors appear
- Run the app (⌘R)
- From
ImplementationSelectionView, click TCA (The Composable Architecture) - Verify the 3-pane NavigationSplitView appears
- Test navigation:
- Select different categories in the sidebar
- Select items in the content list
- Verify detail view updates correctly
- Test the Settings category:
- Should show a custom settings form instead of item list
- Test state updates:
- Toggle switches in settings
- Verify changes persist while navigating
- Run the app (⌘R)
- From
ImplementationSelectionView, click Redux - Verify the 3-pane NavigationSplitView appears
- Test navigation (same as TCA):
- Category selection
- Item selection
- Detail view updates
- Test the Settings category
- Test state updates and action dispatch
Error: Cannot find 'ComposableArchitecture' in scope
Solution:
- Ensure the TCA package was added correctly (Step 1)
- Clean build folder: Product > Clean Build Folder (⇧⌘K)
- Rebuild the project
Error: Multiple commands produce .../README.md
Solution:
- Follow Step 4 to remove README files from target membership
- Alternatively, rename README files to be unique (e.g.,
TCA_README.md)
Solution:
- Files were created in the file system but not added to Xcode project
- Follow Steps 2 and 3 to add files manually
- Alternatively, drag-and-drop the folders into Xcode's Project Navigator
Possible causes:
- TCA package not properly linked
- Minimum iOS version incompatible (TCA requires iOS 16.0+)
- Swift version mismatch
Solution:
- Check project settings: Target > Build Settings > Deployment Target
- Ensure iOS 16.0+ and macOS 13.0+
- Verify Swift version is 5.9 or later
The TCA and Redux implementations require:
- iOS 16.0+ / macOS 13.0+
- Swift 5.9+
- Xcode 15.0+
- TCA 1.0.0+ (for TCA pattern only)
After completing setup, refer to these documents for learning:
- Documentation/TCA_Architecture.md - TCA pattern deep dive
- Documentation/Redux_Architecture.md - Redux pattern deep dive
- Examples/TCA/README.md - TCA implementation guide
- Examples/Redux/README.md - Redux implementation guide
- Documentation/CONCEPTUAL_OVERVIEW.md - Visual comparison of all patterns
Once setup is complete and tests pass:
- Read through the architecture documentation
- Explore the code with inline comments
- Compare TCA vs Redux patterns
- Try modifying the implementations to learn the patterns
- Experiment with adding new features using each pattern
Note: This is a teaching repository. The implementations prioritize clarity and pedagogy over production optimization. All code includes extensive comments explaining the "why" behind architectural decisions.