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 Actor-isolated state
Project style 13 scanned source file(s) across Swift, organized around ranked entry, type, and file boundaries.

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 {
    // ...
}

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

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

Class and protocol design

AgeAssuranceAndPermissions/AgeAssuranceAndPermissionsApp.swift:13 — representative type boundary

struct AgeAssuranceAndPermissionsApp: App {
    // ...
}
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

    @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
Actor-isolated state AgeAssuranceAndPermissions/ComplianceManager.swift:11 Actor annotations make the concurrency ownership boundary explicit.

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 AgeAssuranceAndPermissionsApp
AgeAssuranceAndPermissions/ComplianceManager.swift ComplianceManager
AgeAssuranceAndPermissions/ContentView.swift ContentView
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