Foundation sample architecture
Source-backed, high-level architecture notes for Apple sample-code pages grouped in the Foundation folder.
- Catalog module label:
Foundation - Coverage: 8 / 8 sample pages documented
- Source policy: archive hashes and extracted-tree references are verified locally before analysis
Samples
| Sample | Platforms | High-level architecture | Documented patterns |
|---|---|---|---|
| Building a Localized Food-Ordering App | iOS, iPadOS, Mac Catalyst, watchOS | Two app targets: a SwiftUI food-order flow and a small watch app; both favor view-local state and Foundation value types. | Value model, Unidirectional callback, Composition, Framework data source |
| Building a resumable upload server with SwiftNIO | — | — | Adapter, State machine, Registry, Virtual channel |
| Continuing User Activities with Handoff | iOS, iPadOS, Mac Catalyst, macOS | Parallel UIKit/AppKit controllers share store models, search logic, an initial-region state enum, and an NSUserActivity encoding extension. |
Cross-platform shared model, Activity codec, State machine, Callback |
| Displaying Human-Friendly Content | iOS, iPadOS, Mac Catalyst, macOS | A cross-platform catalog whose navigation root composes self-contained formatter demonstration views. | Catalog, View-local state, Value wrapper, Platform adapter |
| Increasing App Usage with Suggestions Based on User Activities | iOS, iPadOS, Mac Catalyst | A storyboard tab app with separate controller-led examples; AppDelegate routes system entry events to the relevant tab. |
Model-View-Controller, Activity donation, Framework delegate, Application routing |
| Language Introspector | iOS, iPadOS, Mac Catalyst, macOS | A SwiftUI navigation shell routes through AppScreen; each feature owns one or more main-actor observable models and passes them to bindable child views. |
Observable model, Model-View, Enum router, Feature slicing |
| Synchronizing App Preferences with iCloud | iOS, iPadOS, Mac Catalyst, macOS | Platform-specific MVC screens share a ViewController extension that observes cloud changes and synchronizes UserDefaults with NSUbiquitousKeyValueStore. |
Shared extension, Observer, Mutation gateway, Platform adapter |
| Using JSON with custom types | — | Each page is an independent executable lesson with local JSON, local types, encoder/decoder calls, and printed output. | Codable, Data transfer object, Adapter initializer, Custom coding key |
Cross-sample signals
Recurring documented patterns
| Pattern label | Sample documents |
|---|---|
| State machine | 2 |
| Platform adapter | 2 |
Type-role naming evidence
Counts below are declaration-name suffixes, not inferred patterns.
| Role suffix | Distinct declarations across samples |
|---|---|
View |
31 |
Controller |
9 |
Model |
8 |
App |
4 |
Delegate |
3 |
Store |
2 |
Handler |
1 |
Recorder |
1 |
Service |
1 |
Swift access-control evidence
These are declaration occurrences in scanned Swift source, including implicit internal declarations.
| Access level | Occurrences |
|---|---|
implicit internal |
1140 |
public |
283 |
private |
187 |
fileprivate |
5 |
internal |
2 |
private(set) |
1 |
References
Generated from the verified local catalog and completed Markdown documents.