2.0 KiB
2.0 KiB
Workflow: Add a Feature to an Existing iOS App
<required_reading> Read these NOW:
- references/app-architecture.md
- references/swiftui-patterns.md
Plus relevant refs based on feature (see Step 2). </required_reading>
## Step 1: Understand the FeatureAsk:
- What should it do?
- Where does it belong in the app?
- Any constraints?
Step 2: Read Relevant References
| Feature Type | Reference |
|---|---|
| Data persistence | references/data-persistence.md |
| Networking/API | references/networking.md |
| Push notifications | references/push-notifications.md |
| In-app purchases | references/storekit.md |
| Background tasks | references/background-tasks.md |
| Navigation | references/navigation-patterns.md |
| Polish/UX | references/polish-and-ux.md |
Step 3: Understand Existing Code
Read:
- App entry point
- State management
- Related views
Identify patterns to follow.
Step 4: Implement with TDD
- Write test for new behavior → RED
- Implement → GREEN
- Refactor
- Repeat
Step 5: Integrate
- Wire up navigation
- Connect to state
- Handle errors
Step 6: Build and Test
xcodebuild -scheme AppName -destination 'platform=iOS Simulator,name=iPhone 16' build test
xcrun simctl launch booted com.company.AppName
Step 7: Polish
- Haptic feedback for actions
- Animations for transitions
- Accessibility labels
- Dynamic Type support
<integration_patterns> Adding state:
@Observable
class AppState {
var newFeatureData: [NewType] = []
func performNewFeature() { ... }
}
Adding a view:
struct NewFeatureView: View {
@Environment(AppState.self) private var appState
var body: some View { ... }
}
Adding navigation:
NavigationLink("New Feature", value: NewFeatureDestination())
.navigationDestination(for: NewFeatureDestination.self) { _ in
NewFeatureView()
}
Adding a tab:
TabView {
NewFeatureView()
.tabItem { Label("New", systemImage: "star") }
}
</integration_patterns>