WWDC21 Challenge: Large Text Challenge
At a glance
| Item | Summary |
|---|---|
| Purpose | Design for large text sizes by modifying the user interface. |
| App architecture | A Swift sample with the source-visible chain LargeTextChallengeApp → ContentView → SwiftUI / UIKit APIs. |
| Main patterns | Protocol-oriented abstraction, Binding-based state propagation, Publisher-backed observable state |
| Project style | 17 scanned source file(s) across Swift, organized around ranked entry, type, and file boundaries. |
| Execution model | No structured execution marker indexed; callback threading requires source review. |
| State/event model | Source-visible mechanisms: SwiftUI state property wrapper, ObservableObject, @Published. |
| Key frameworks/packages | SwiftUI, UIKit; these are source dependencies, not architecture labels. |
Project structure
Source bundle/
└── LargeTextChallenge/
├── LargeTextChallengeApp.swift
├── Models/
│ ├── Scenario.swift
│ └── Texture.swift
└── Views/
├── IntroView.swift
├── ScenarioFeedbackView.swift
├── Scenarios/
│ ├── ExerciseFour.swift
│ ├── ExerciseThree.swift
│ ├── ExerciseOne.swift
│ ├── ExerciseFive.swift
│ └── ExerciseTwo.swift
├── ContentView.swift
└── Supporting/
└── ImageShapes.swift
Structure observations
- Architecturally prominent files are ranked from entry points and role-named declarations; resource-only paths are omitted.
- Primary languages: Swift.
- The verified tree contains 4 project/configuration file(s) and 44 source declaration(s).
Overall architecture
flowchart LR
N1["LargeTextChallengeApp"]
N2["ContentView"]
N3["SwiftUI / UIKit APIs"]
N1 --> N2
N2 --> N3
Reference code
LargeTextChallenge/LargeTextChallengeApp.swift:10 — architecture anchor
@main
struct LargeTextChallengeApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}Interpretation
The arrows summarize the source-visible entry, role-named types or folders, and framework direction; when nodes come from structural folders, the sequence is a high-level interpretation rather than proof that every adjacent node calls the next. Ownership is claimed only where the next section cites a stored property or assignment. The diagram is intentionally limited to the dominant path into Accessibility.
Ownership and state
classDiagram
Scenario *-- Int : id
Scenario *-- String : name
Scenario *-- String : description
Scenario o-- ScenarioKey : exercise
Ownership evidence
LargeTextChallenge/Models/Scenario.swift:12 — stored dependency or nearest verified ownership anchor
struct Scenario: Hashable, Codable, Identifiable {
let id: Int
let name: String
let description: String
let exercise: ScenarioKey
let feedback: [ScenarioFeedback]
}| Owner | Object or state | Relationship | Mutation authority |
|---|---|---|---|
Scenario |
Int (id) |
owns value state | Initialized by the owner; the binding is immutable |
Scenario |
String (name) |
owns value state | Initialized by the owner; the binding is immutable |
Scenario |
String (description) |
owns value state | Initialized by the owner; the binding is immutable |
Scenario |
ScenarioKey (exercise) |
stores or receives | Initialized by the owner; the binding is immutable |
Composition arrows indicate a source-visible construction expression or locally owned value state; aggregation means the owner stores or receives a dependency without proving exclusive lifetime ownership.
Concurrency, scheduling, and thread safety
Evidence limit: actor isolation, async/await, or Task creation does not by itself prove background-thread execution; Sendable conformance alone does not prove thread-safe mutation.
No source-visible execution, scheduling, or synchronization boundary was found in the indexed source.
@MainActor/MainActor.run, DispatchQueue.main, and RunLoop.main are reported as distinct isolation, queue, and event-loop mechanisms. A plain Task is kept separate from Task.detached; neither is labeled as a background thread.
State propagation, frameworks, and dependencies
Evidence limit: an import proves a source-level compilation dependency at the cited line; it does not prove runtime use, architectural adoption, or whether a Swift package is a direct application dependency.
| Category | Mechanism or module | Verified role | Evidence |
|---|---|---|---|
| State propagation | SwiftUI state property wrapper |
A SwiftUI property wrapper supplies or observes UI state. | LargeTextChallenge/Views/IntroView.swift:58 |
| State propagation | ObservableObject |
ObservableObject supplies an observation contract. | LargeTextChallenge/Views/Scenarios/ExerciseFive.swift:15 |
| State propagation | @Published |
A published property can emit owner-controlled changes. | LargeTextChallenge/Views/Scenarios/ExerciseFive.swift:22 |
| Source import | SwiftUI |
The cited file imports this module; runtime use and architectural role are not inferred. | LargeTextChallenge/Extensions/HelperExtensions.swift:8 |
| Source import | UIKit |
The cited file imports this module; runtime use and architectural role are not inferred. | LargeTextChallenge/Models/Data.swift:8 |
receive(on:) describes downstream delivery scheduling, while subscribe(on:) describes upstream subscription/request/cancel scheduling. An import Combine alone establishes neither behavior nor a Store, reducer, Redux, or other application architecture.
Class and protocol design
LargeTextChallenge/Views/ScenarioFeedbackView.swift:11 — representative type boundary
protocol ScenarioFeedbackProtocol {
func results() -> [ScenarioFeedbackResult]
}| Type | Responsibility | Depends on or conforms to |
|---|---|---|
LargeTextChallengeApp |
Application entry and top-level composition | App |
IntroView |
User-interface presentation and input forwarding | View |
ScenarioFeedbackView |
User-interface presentation and input forwarding | View |
ExerciseThreeTextView |
User-interface presentation and input forwarding | View |
ExerciseThreeLargeImageView |
User-interface presentation and input forwarding | View |
ExerciseThreeImageView |
User-interface presentation and input forwarding | View |
ContentView |
User-interface presentation and input forwarding | View |
ExerciseOneTextView |
User-interface presentation and input forwarding | View |
ExerciseOneButtonView |
User-interface presentation and input forwarding | View |
ScenarioFeedbackProtocol |
Defines a capability or collaboration contract | Concrete collaborators/imported frameworks |
The source explicitly defines local protocol relationships: ExerciseFiveProperties → ScenarioFeedbackProtocol, ExerciseFourProperties → ScenarioFeedbackProtocol, ExerciseOneProperties → ScenarioFeedbackProtocol, ExerciseThreeProperties → ScenarioFeedbackProtocol, ExerciseTwoProperties → ScenarioFeedbackProtocol.
Access control
| Symbol | Access | Verified effect | Likely rationale |
|---|---|---|---|
imageName (LargeTextChallenge/Models/Texture.swift:13) |
fileprivate |
Use is restricted to this source file. | Inference: share with same-file helpers or extensions without exposing the symbol module-wide. |
isPresented (LargeTextChallenge/Views/IntroView.swift:13) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: keep state mutation or dependency lifetime inside the owning implementation. |
isFinalPage (LargeTextChallenge/Views/IntroView.swift:15) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: keep state mutation or dependency lifetime inside the owning implementation. |
textStrings (LargeTextChallenge/Views/IntroView.swift:17) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: keep state mutation or dependency lifetime inside the owning implementation. |
Reference code
LargeTextChallenge/Models/Texture.swift:13 — representative boundary
struct Texture: Hashable, Codable, Identifiable {
let id: Int
let name: String
fileprivate let imageName: String
}Swift declarations without a modifier are internal; explicit private, fileprivate, private(set), public, or open entries above are interpreted by language semantics. Objective-C/C samples instead rely on header and implementation boundaries, which are not equivalent to Swift lexical privacy.
Logic ownership and placement
| Logic | Owning type or file | Placement rationale |
|---|---|---|
| Application entry and top-level composition | LargeTextChallengeApp |
The source’s App suffix makes this role explicit. |
| User-interface presentation and input forwarding | ContentView, ExerciseOneButtonView, ExerciseOneTextView, ExerciseThreeImageView |
The source’s View suffix makes this role explicit. |
Design patterns
| Pattern | Source evidence | Purpose or tradeoff |
|---|---|---|
| Protocol-oriented abstraction | LargeTextChallenge/Views/Scenarios/ExerciseFive.swift:15 |
A local protocol and concrete conformance create an explicit capability boundary. |
| Binding-based state propagation | LargeTextChallenge/Views/IntroView.swift:58 |
A binding exposes controlled read/write access while the upstream owner remains authoritative. |
| Publisher-backed observable state | LargeTextChallenge/Views/Scenarios/ExerciseFive.swift:23 |
Published properties notify observers while mutation remains with the state object. |
Naming conventions
- Types: App: LargeTextChallengeApp; View: ContentView, ExerciseOneButtonView, ExerciseOneTextView, ExerciseThreeImageView, ExerciseThreeLargeImageView.
- Protocols:
ScenarioFeedbackProtocol. - Methods:
results. - Files:
LargeTextChallenge/LargeTextChallengeApp.swift,LargeTextChallenge/Models/Scenario.swift,LargeTextChallenge/Views/IntroView.swift,LargeTextChallenge/Views/ScenarioFeedbackView.swift,LargeTextChallenge/Views/Scenarios/ExerciseFour.swift,LargeTextChallenge/Views/Scenarios/ExerciseThree.swift.
Architecture takeaways
LargeTextChallengeAppis the main source-visible entry or composition anchor for this sample.- Framework work reaches SwiftUI, UIKit through a deliberately small high-level chain; the detailed API graph remains inside the cited implementation files.
- Stored-property evidence identifies lifecycle collaboration; it does not by itself prove exclusive object ownership.
- Access-control conclusions separate verified language visibility from the likely design rationale.
- Local protocol relationships provide an explicit substitution boundary.
Source map
| Source file | Relevant symbols |
|---|---|
LargeTextChallenge/LargeTextChallengeApp.swift |
Cited implementation, LargeTextChallengeApp |
LargeTextChallenge/Models/Scenario.swift |
Cited implementation, Scenario, ScenarioFeedback, ScenarioFeedbackResult, ScenarioKey, ScenarioPropertyKey |
LargeTextChallenge/Views/ScenarioFeedbackView.swift |
ScenarioFeedbackProtocol, ScenarioFeedbackViewRow, ScenarioFeedbackView |
LargeTextChallenge/Models/Texture.swift |
Cited implementation, Texture |
LargeTextChallenge/Views/IntroView.swift |
Cited implementation, SwiftUI state property wrapper, IntroViewPage, IntroView, IntroView_Previews |
LargeTextChallenge/Views/Scenarios/ExerciseFive.swift |
Cited implementation, ObservableObject, @Published, ExerciseFiveProperties, ExerciseFiveMenu, ExerciseFive |
LargeTextChallenge/Extensions/HelperExtensions.swift |
SwiftUI, Feature implementation |
LargeTextChallenge/Models/Data.swift |
UIKit, Feature implementation |
LargeTextChallenge/Views/Scenarios/ExerciseFour.swift |
ExerciseFourProperties, ExerciseFourSymbolMenu, ExerciseFourHeader, ExerciseFourRow, ExerciseFourList, ExerciseFour |
LargeTextChallenge/Views/Scenarios/ExerciseThree.swift |
ExerciseThreeProperties, ExerciseThreeImageMenu, ExerciseThreeTextView, ExerciseThreeLargeImageView, ExerciseThreeImageView, ExerciseThree |
LargeTextChallenge/Views/ContentView.swift |
ContentView, ContentView_Previews |
LargeTextChallenge/Views/Scenarios/ExerciseOne.swift |
ExerciseOneProperties, ExerciseOneTextMenu, ExerciseOneTextView, ExerciseOneButtonView, ExerciseOne |
LargeTextChallenge/Views/Supporting/ImageShapes.swift |
CircleImage, RoundedImage, SquareImageButton, CircleSymbol, CircleImage_Previews |
LargeTextChallenge/Views/Scenarios/ExerciseTwo.swift |
ExerciseTwoProperties, ExerciseTwoLabelMenu, ExerciseTwo |
LargeTextChallenge/Views/ScenarioList.swift |
ScenarioRow, ScenarioList |
LargeTextChallenge/Views/Styles/CustomButtonStyle.swift |
CustomButtonStyle |