$npx -y skills add dpearson2699/swift-ios-skills --skill app-clipsBuild iOS App Clips with invocation URLs, App Clip Codes, NFC, QR codes, Safari banners, Maps, Messages, target setup, App Store Connect experiences, size/capability constraints, NSUserActivity routing, SKOverlay promotion, App Group/keychain handoff, ephemeral notifications, loc
| 1 | # App Clips |
| 2 | |
| 3 | Build lightweight, instantly available versions of an iOS app for focused in-the-moment experiences or demos. |
| 4 | |
| 5 | ## Contents |
| 6 | |
| 7 | - [App Clip Target Setup](#app-clip-target-setup) |
| 8 | - [Invocation and Experience Routing](#invocation-and-experience-routing) |
| 9 | - [Size and Capability Decisions](#size-and-capability-decisions) |
| 10 | - [Data, Notifications, and Location](#data-notifications-and-location) |
| 11 | - [Common Mistakes](#common-mistakes) |
| 12 | - [Review Checklist](#review-checklist) |
| 13 | - [References](#references) |
| 14 | |
| 15 | ## App Clip Target Setup |
| 16 | |
| 17 | An App Clip is a **separate target** in the same Xcode project as your full app: |
| 18 | |
| 19 | 1. **File → New → Target → App Clip** — Xcode creates the App Clip target, adds the **Embed App Clip** build phase to the full app target, and wires the association entitlements. |
| 20 | 2. The App Clip bundle ID **must** be prefixed by the full app's bundle ID: `com.example.MyApp.Clip`. |
| 21 | 3. Verify raw entitlement keys when diagnosing archive, signing, or App Store Connect failures: |
| 22 | - App Clip target: `com.apple.developer.on-demand-install-capable` |
| 23 | - App Clip target parent app link: `com.apple.developer.parent-application-identifiers` |
| 24 | - Full app target associated App Clip link: `com.apple.developer.associated-appclip-app-identifiers` |
| 25 | |
| 26 | Use Swift packages or shared source files for code needed by both targets. Add App Clip-specific compile branches with the `APPCLIP` active compilation condition, and avoid linking full-app-only frameworks into the App Clip target. |
| 27 | |
| 28 | **Validation checkpoint:** Archive both targets and inspect their archived |
| 29 | entitlements. If signing or validation fails, correct the three raw key/target |
| 30 | assignments above and rearchive until both pass. |
| 31 | |
| 32 | ## Invocation and Experience Routing |
| 33 | |
| 34 | Read [`references/routing-and-experiences.md`](references/routing-and-experiences.md) when implementing invocation URL routing, App Store Connect experiences, Local Experiences, Safari Smart App Banners, QR/NFC/App Clip Codes, AASA, or associated domains. |
| 35 | |
| 36 | App Clips receive `NSUserActivityTypeBrowsingWeb` activities. Keep the invocation router shared with the full app because, after installation, the full app replaces the App Clip and receives future invocations. |
| 37 | |
| 38 | - SwiftUI: use `.onContinueUserActivity(NSUserActivityTypeBrowsingWeb)`. |
| 39 | - UIKit cold launch: inspect `connectionOptions.userActivities` in `scene(_:willConnectTo:options:)`. |
| 40 | - UIKit continuation: handle the actual `NSUserActivity` in `scene(_:continue:)`. |
| 41 | - `scene(_:willContinueUserActivityWithType:)` is only advance notice and does not provide the URL. |
| 42 | |
| 43 | Configure the required default App Clip experience in App Store Connect. Use advanced experiences for Maps integration, location association, production App Clip Codes, per-location cards, and precise physical-place routing; demo App Clip Codes can use the short demo App Clip link. |
| 44 | |
| 45 | For custom URLs, add `appclips:example.com` to Associated Domains on both the full app and App Clip targets, and host an AASA file with the App Clip app identifier. For Safari banners, use `app-id`, `app-clip-bundle-id`, and optional `app-clip-display=card`; do not rely on `app-argument` for App Clip launches. |
| 46 | |
| 47 | **Validation checkpoint:** Exercise each URL with `_XCAppClipURL` and a Local |
| 48 | Experience, fix routing/AASA/experience mismatches, and repeat until the App |
| 49 | Clip and installed full app reach the same destination. |
| 50 | |
| 51 | ## Size and Capability Decisions |
| 52 | |
| 53 | Use [Size, capabilities, and promotion](references/size-capabilities-and-promotion.md) |
| 54 | as the authoritative checklist for feasibility reviews, size tiers and measurement, |
| 55 | Background Assets, CloudKit, Live Activities, unsupported features, and full-app |
| 56 | promotion. Load it whenever any of those topics is in scope. |
| 57 | |
| 58 | Keep product reviews at the boundary level: state the size basis, invocation and |
| 59 | download fit, capability exclusions, and handoff destination. Add implementation |
| 60 | APIs only when the user asks for implementation. |
| 61 | |
| 62 | ## Data, Notifications, and Location |
| 63 | |
| 64 | Read [`references/data-handoff-notifications-location.md`](references/data-handoff-notifications-location.md) when implementing App Group/full-app migration, keychain or Sign in with Apple handoff, ephemeral notifications, notification relaunch routing, or physical location confirmation. |
| 65 | |
| 66 | Treat App Group storage as non-secret handoff state, not a trust boundary. The |
| 67 | reference owns the iOS 15.4+ one-way keychain rule, Sign in with Apple |
| 68 | verification, ephemeral-notification permission and relaunch routing, and |
| 69 | physical-location confirmation—including their req |