Sample CodeiOS, iPadOS, Mac CatalystReviewed 2026-07-21View on Apple Developer

Implementing age assurance and permissions

At a glance

Item Summary
Purpose Create a significant change flow to inform people about important updates in your app and request age-related permissions.
App architecture A Swift sample with the source-visible chain AgeAssuranceAndPermissionsAppContentViewComplianceManagerDeclaredAgeRange APIs.
Main patterns No named application pattern supported by the extracted structure
Project style 13 scanned source file(s) across Swift, organized around ranked entry, type, and file boundaries.
Execution model Source-visible boundaries: await suspension point, @MainActor, Task; none alone proves a background thread.
State/event model Source-visible mechanisms: SwiftUI state property wrapper, @Observable, NotificationCenter.
Key frameworks/packages SwiftUI, OSLog, DeclaredAgeRange, Foundation, PermissionKit; these are source dependencies, not architecture labels.

Project structure

Source bundle/
└── AgeAssuranceAndPermissions/
    ├── AgeAssuranceAndPermissionsApp.swift
    ├── ComplianceManager.swift
    ├── ContentView.swift
    ├── ImageView.swift
    ├── MapView.swift
    ├── RequestParentalApprovalView.swift
    ├── SignificantChangeInformationView.swift
    ├── SignificantChangeVersionManager.swift
    ├── SignificantChangeView.swift
    ├── VideoPlayerView.swift
    ├── Helpers.swift
    └── SignificantChange.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 15 source declaration(s).

Overall architecture

Reference code

AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:12 — architecture anchor

@main
struct AgeAssuranceAndPermissionsApp: App {
    @State private var complianceManager = ComplianceManager()
    // ...
}

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 Declared Age Range.

Ownership and state

Ownership evidence

AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:14 — stored dependency or nearest verified ownership anchor

@main
struct AgeAssuranceAndPermissionsApp: App {
    @State private var complianceManager = ComplianceManager()
    // ...
}
Owner Object or state Relationship Mutation authority
AgeAssuranceAndPermissionsApp ComplianceManager (complianceManager) owns wrapper-managed state Owning lexical scope
AgeAssuranceAndPermissionsApp SignificantChangeVersionManager (versionManager) owns wrapper-managed state Owning lexical scope
AgeAssuranceAndPermissionsApp Logger (logger) creates and retains Initialized by the owner; the binding is immutable
ComplianceManager Bool (isComplianceRequired) owns value state App/module collaborators

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.

Concern Source mechanism Verified placement or handoff Evidence
Suspension boundary await suspension point The source declares or crosses an asynchronous boundary; it does not by itself establish background execution. AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:26
Main isolation @MainActor The cited annotation marks its attached declaration or closure as main-actor isolated. AgeAssuranceAndPermissions/ComplianceManager.swift:11
Task creation Task The source creates an unstructured task; surrounding context determines inherited actor isolation. AgeAssuranceAndPermissions/SignificantChangeVersion.swift:50

@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.

Reference code

AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:26 — representative execution boundary

                    await complianceManager.identifyRegulatoryRequirements()
                    if complianceManager.isComplianceRequired {
                        await versionManager.synchronize()
                        // ...
                    }

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. AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:14
State propagation @Observable Observation macro publishes source-visible changes. AgeAssuranceAndPermissions/ComplianceManager.swift:12
State propagation NotificationCenter NotificationCenter distributes named process-local events. AgeAssuranceAndPermissions/SignificantChangeVersion.swift:52
Source import SwiftUI The cited file imports this module; runtime use and architectural role are not inferred. AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:10
Source import OSLog The cited file imports this module; runtime use and architectural role are not inferred. AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:8
Source import DeclaredAgeRange The cited file imports this module; runtime use and architectural role are not inferred. AgeAssuranceAndPermissions/ComplianceManager.swift:9
Source import Foundation The cited file imports this module; runtime use and architectural role are not inferred. AgeAssuranceAndPermissions/Helpers.swift:10
Source import PermissionKit The cited file imports this module; runtime use and architectural role are not inferred. AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:9

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

AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:13 — representative type boundary

@main
struct AgeAssuranceAndPermissionsApp: App {
    @State private var complianceManager = ComplianceManager()
    // ...
}
Type Responsibility Depends on or conforms to
AgeAssuranceAndPermissionsApp Application entry and top-level composition App
ComplianceManager Long-lived feature or framework coordination Concrete collaborators/imported frameworks
ContentView User-interface presentation and input forwarding View
ImageView User-interface presentation and input forwarding View
MapView User-interface presentation and input forwarding View
RequestParentalApprovalView User-interface presentation and input forwarding View
SignificantChangeInformationView User-interface presentation and input forwarding View
SignificantChangeVersionManager Long-lived feature or framework coordination Concrete collaborators/imported frameworks
SignificantChangeView User-interface presentation and input forwarding View
VideoPlayerView User-interface presentation and input forwarding View

No local protocol conformance is claimed as protocol-oriented design; external framework conformances are listed only as dependencies.

Access control

Symbol Access Verified effect Likely rationale
complianceManager (AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:14) 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.
versionManager (AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.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.
regulatoryFeatures (AgeAssuranceAndPermissions/ComplianceManager.swift:27) 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.
complianceManager (AgeAssuranceAndPermissions/ContentView.swift:11) 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

AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:14 — representative boundary

@main
struct AgeAssuranceAndPermissionsApp: App {
    @State private var complianceManager = ComplianceManager()
    // ...
}

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 AgeAssuranceAndPermissionsApp The source’s App suffix makes this role explicit.
Long-lived feature or framework coordination ComplianceManager, SignificantChangeVersionManager The source’s Manager suffix makes this role explicit.
User-interface presentation and input forwarding ContentView, ImageView, MapView, RequestParentalApprovalView The source’s View suffix makes this role explicit.

Design patterns

Pattern Source evidence Purpose or tradeoff
No named application pattern AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:12 The verified source directly composes concrete framework types; this document avoids forcing a pattern name.

Naming conventions

  • Types: App: AgeAssuranceAndPermissionsApp; Manager: ComplianceManager, SignificantChangeVersionManager; View: ContentView, ImageView, MapView, RequestParentalApprovalView, SignificantChangeInformationView.
  • Protocols: no local protocol declaration in the scanned source.
  • Methods: identifyRegulatoryRequirements, textStyle, synchronize, handleAllChanges, handlePendingChanges.
  • Files: AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift, AgeAssuranceAndPermissions/ComplianceManager.swift, AgeAssuranceAndPermissions/ContentView.swift, AgeAssuranceAndPermissions/ImageView.swift, AgeAssuranceAndPermissions/MapView.swift, AgeAssuranceAndPermissions/RequestParentalApprovalView.swift.

Architecture takeaways

  • AgeAssuranceAndPermissionsApp is the main source-visible entry or composition anchor for this sample.
  • Framework work reaches SwiftUI, DeclaredAgeRange, PermissionKit, AVKit 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.
  • The source does not justify labeling the design protocol-oriented.

Source map

Source file Relevant symbols
AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift Cited implementation, AgeAssuranceAndPermissionsApp, await suspension point, SwiftUI state property wrapper, SwiftUI, OSLog, PermissionKit
AgeAssuranceAndPermissions/ComplianceManager.swift Cited implementation, @MainActor, @Observable, DeclaredAgeRange, ComplianceManager
AgeAssuranceAndPermissions/ContentView.swift Cited implementation, ContentView
AgeAssuranceAndPermissions/SignificantChangeVersion.swift Task, NotificationCenter, SignificantChangeVersion
AgeAssuranceAndPermissions/Helpers.swift Foundation, SignificantChangePhase, AgeRangeResult, SignificantChangeError
AgeAssuranceAndPermissions/ImageView.swift ImageView
AgeAssuranceAndPermissions/MapView.swift MapView
AgeAssuranceAndPermissions/RequestParentalApprovalView.swift RequestParentalApprovalView
AgeAssuranceAndPermissions/SignificantChangeInformationView.swift SignificantChangeInformationView
AgeAssuranceAndPermissions/SignificantChangeVersionManager.swift SignificantChangeVersionManager
AgeAssuranceAndPermissions/SignificantChangeView.swift SignificantChangeView
AgeAssuranceAndPermissions/VideoPlayerView.swift VideoPlayerView
AgeAssuranceAndPermissions/SignificantChange.swift SignificantChange