← Tutti i modelli

View piccole, async/await per i dati, Dynamic Type e VoiceOver testati su ogni schermata.

Constitution — iOS app with SwiftUI

Version 1.0.0 · Ratified 2026-11-10

These principles hold for every spec, plan and task of the project. A spec may add rules; it never weakens these.

  1. Small views. A view's body fits on one screen and pieces are extracted into subviews. Views hold no business logic; it lives in @Observable models that are tested on their own.

  2. async/await for data. Networking and storage use async/await, started from the .task modifier so work is cancelled when the view goes away. New code adds no completion handlers, and UI state changes on the @MainActor.

  3. Dynamic Type and VoiceOver on every screen. Text uses text styles, and every screen is checked at the largest accessibility size and with VoiceOver. Every control has an accessibility label, and a UI test runs performAccessibilityAudit() on each screen.

  4. Previews for every view. Every view has a #Preview with sample data in light mode, dark mode and a large type size. A view that cannot be previewed has a dependency that should be injected.

  5. Strict concurrency. The project builds in the Swift 6 language mode with complete concurrency checking. A data race is a compile error, and @unchecked Sendable needs a reason in the review.

  6. One source of truth. Each piece of state has one owner: @State for private view state, @Binding to share it down and @Environment for dependencies. The same state stored in two places is a defect.

  7. Tested before merge. Models and services are covered with Swift Testing and the critical flows with XCUITest. The suite is green before the merge.

  8. Private by default. Tokens and credentials live in the Keychain, the app ships a privacy manifest that matches what it collects, and there are no App Transport Security exceptions.