Skip to content
Studio

Apple

StudioKit (packages/swift) and the Studio app (apps/apple) for iPhone, iPad and Mac. The StudioKit and Apple app sections below are written by their owners.

Verification

No Swift toolchain runs in this repository's Linux environment, and GitHub Actions is not running. Every .swift file is parsed by make syntax (tree-sitter-swift 0.7.1) and checked against the generated token names; none of it is compiled until Xcode builds it. Say "not compiled" for any Swift no compiler has built.

On a Mac with Xcode 27:

make apple                                        # swift build, swift test, xcodebuild for the app
make apple APPLE_DESTINATION='platform=macOS'
make apple-test                                   # the app's unit tests (StudioTests) on macOS

The syntax gate

tools/swift-syntax.mjs parses every .swift file under packages/swift and apps/apple and fails on any syntax error, printed as file:line:column.

  • #if, #elseif, #else and #endif lines are blanked before parsing (the grammar rejects #if inside a type body), so every branch must parse on its own.
  • tree-sitter-swift 0.7.1 does not parse typed throws (throws(E)), the sending modifier or nonisolated(unsafe). Avoid them; where one is needed, end the line with // syntax-gate: grammar-gap typed-throws (or sending, nonisolated-unsafe). Waived lines are counted in the output.

Tokens and fonts

Read the generated StudioTokens.swift (Tokens). The TrueType fonts and their licences are copied into packages/swift/Sources/StudioKit/Resources/Fonts/ by tools/sync-fonts.mjs; never add or remove files there by hand.

StudioKit

The API, the Liquid Glass policy, accessibility and the open items are in packages/swift/README.md.

  • Toasts. Give each window its own centre with .studioToasts() on the WindowGroup root, not one centre at the App level. Mark bottom chrome (narrow-navigation circles, a dock) with .studioBottomChrome(isActive:). It publishes its height to the window's toast centre, and the toast lane sits s-2 above it rather than covering it.
  • No raw values. A view reads tokens. A number written in a view is a proportion of a token or of the view's own geometry, and it carries a comment saying so.

The Studio app

apps/apple/Studio.xcodeproj is one multiplatform SwiftUI target for iPhone, iPad and Mac (iOS 18+, macOS 15+), built on StudioKit as a local package (../../packages/swift), plus a Swift Testing target. It works offline on a seeded "Sample workspace" with SwiftData, and publishes and sells nothing. It is written and gated, not compiled. How to open, run, test and sign, the architecture, and the open risks are in apps/apple/README.md.

  • Project file. Hand-written, objectVersion 77, with PBXFileSystemSynchronizedRootGroup folders. A file added under apps/apple/Studio/ or apps/apple/StudioTests/ joins its target with no project edit. Info.plist keys are INFOPLIST_KEY_* build settings, so don't add an Info.plist to the folder.
  • Isolation. The app target defaults to MainActor isolation (SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor, Approachable Concurrency, Swift 6 mode). StudioKit defaults to nonisolated. Mark pure value types nonisolated when they serve as SwiftUI identifiers or cross into Transferable or @concurrent code. Mark anything that touches a Resource @MainActor.
  • Navigation (Studio 2.2): no navigation sidebar on any platform. Three sections, Home · Resources · Analytics, with Resources scoped to All or one of the nine kinds by a kind picker in the list:
    • iPhone: the system TabView with three tabs. New is a toolbar + on each tab's root (tab bars navigate; toolbars act) and opens the New sheet of the nine kinds; search is .searchable at the top of Resources; the account is at the leading edge.
    • iPad: the same TabView, iPadOS 18's floating tab bar at the top, with .tabViewStyle(.tabBarOnly) so it never adapts into a sidebar.
    • Mac: one window whose toolbar holds the destination picker (Home · Resources · Analytics), the search field (.searchable(placement: .toolbar), ⌘F) and New.
    • The system draws every bar; set no bar background.
  • Editing model (one editor workspace for all nine kinds): StudioKit's StudioEditorWorkspace covers the window (a fullScreenCover on iPhone and iPad, the window's content on the Mac). Wide (from editor-sheet-at): the library leads as a collapsible floating panel (glass), the live preview fills the centre on StudioCanvas, and the inspector trails as the system .inspector. Narrow: the preview fills the screen and Library and Settings are sheets from a floating glass bar. The editor bar is the system toolbar. Every kind but the Bio page holds a ResourceDraft with an explicit Save (enabled when valid and changed) and a discard guard on leave; a QR code adds Export (PNG, SVG); the Bio page autosaves and publishes with its own undo history. Each kind's inspector follows Cardsite's field order (the address first for every addressable kind) with one collapsed More options. Files come in through fileImporter, read off the main actor; a static page is drawn by StudioStaticFrame, a WKWebView with JavaScript off and no navigation.
  • Kinds. StudioKind has the nine kinds in the New sheet's order with the spec's ids (link, biopage, vcard, event, file, static as .staticPage, splash, payment, qr) and their words, tones, metric, primary action and save model. 2.1's site reads as .biopage (StudioKind(storedValue:), and in JSON); the app rewrites stored site once at launch.
  • Stored values grow by default. Every new SwiftData property has a default or is optional, and structured values are JSON decoded leniently (KeyedDecodingContainer.lenient): a missing or mistyped key reads as its default, so a record from an older or newer build still opens. Images (a vCard photo, a QR logo, a social card image, a page's photos) are their own fields, never inside JSON that autosave or undo re-encodes.
  • Bindings. Avoid Binding(get:set:) (its closures' isolation is a Swift 6 risk): bind models with @Bindable, or keep a @State copy in a small view and report changes, as the canvas does. The page inspector's Synced(value:onChange:) wraps any control that way.
  • Gates that stand in for a build. make validate runs all of them. Run it after any change under apps/apple or packages/swift. With STRICT=1, a SKIPPED step fails:

`` node tools/swift-syntax.mjs node packages/swift/scripts/swift-symbols.mjs node packages/swift/scripts/token-table.mjs --check node apps/apple/scripts/api-crosscheck.mjs # StudioKit call labels against the declarations python3 -I apps/apple/scripts/check-pbxproj.py apps/apple/Studio.xcodeproj/project.pbxproj # standard library only python3 -I apps/apple/scripts/check-assets.py apps/apple # needs Pillow; SKIPPED without it ``

The pbxproj check also fails when a target imports a package product (import StudioKit) without listing it in packageProductDependencies and linking it.

  • CI. .github/workflows/apple.yml lists the installed Xcodes and selects the newest Xcode 27 explicitly. If Xcode 27 is absent, it selects the newest Xcode 26 with a warning annotation. With neither, the job fails. It prints the version it built with and never falls back to the runner's default.
  • Icons are rendered from the bundled Bounded TTF by python3 -I apps/apple/scripts/render-icons.py. The iOS 1024 is opaque RGB, because App Review rejects alpha. Every macOS size is RGBA on the macOS icon grid: a rounded body with a transparent margin.
Contents