iOS App Clips Development Guide with SwiftUI and UIKit
This article provides a comprehensive guide to creating iOS 14 App Clips, covering usage scenarios, SwiftUI and UIKit implementation, URL handling, Apple Connect configuration, binary download behavior, data sharing, permission management, code differences, testing, and submission considerations for mobile developers.
iOS 14 introduced App Clips, lightweight versions of apps that can be launched without installing the full app, similar to mini‑programs.
App Clips are limited in size to ensure fast loading, so developers must focus on core functionality.
Usage flow : App Clips can be invoked via Safari banners, iMessage links, or QR‑like codes. When a user taps the banner, the system passes a URL to the App Clip, which parses it to display the appropriate content.
Development : In Xcode create a new target of type “App Clip” and add it to the main project. App Clips can be built with SwiftUI (recommended) or UIKit. Example SwiftUI entry point:
struct FrutaAppClip: App {
var body: some Scene {
WindowGroup {
NavigationView {
SmoothieMenu()
}
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb, perform: handleUserActivity)
}
}
func handleUserActivity(_ userActivity: NSUserActivity) {
guard let incomingURL = userActivity.webpageURL,
let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true),
let queryItems = components.queryItems else { return }
// handle parameters
}
}For UIKit the URL is received in scene(_:continue:) :
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL else { return }
presentExperience(for: url)
}
func presentExperience(for url: URL) {
// Route user to the appropriate place in your App Clip.
}Apple Connect configuration : Each App Clip has a single configuration that includes title, subtitle, cover image, and one or more URLs. The bundle identifier should follow the pattern {AppBundleID}+Clip . The configuration is delivered to Apple as a JSON file similar to an Universal Link file, hosted on HTTPS without redirects.
Example server JSON:
{
"applinks": {
"details": [
{
"appIDs": ["ABCDE12345.com.example.app", "ABCDE12345.com.example.app2"],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
}
]
}
]
},
"webcredentials": {
"apps": ["ABCDE12345.com.example.app"]
}
}Data sharing : App Clips and the main app are mutually exclusive; when the full app is installed the App Clip is removed. Shared data is transferred via an App Group. Use NSUserDefaults(suiteName: "group.company.appGroupName") or containerURLForSecurityApplicationGroupIdentifier to read/write shared files.
Permissions : App Clips request “ephemeral” permissions for notifications and location, which are temporary (8 hours) and can be toggled on the Clip card. These are declared in Info.plist with keys NSAppClipRequestEphemeralUserNotification and NSAppClipRequestLocationConfirmation .
Code differences : Use compile‑time flags such as #if APPCLIP … #else … #endif to include or exclude code for the Clip target. Certain frameworks (CallKit, CloudKit, HealthKit, HomeKit, ResearchKit, SensorKit, Speech, etc.) are not available in App Clips.
Local testing : Configure the test URL in Apple Connect, enable the _XCAppClipURL environment variable, and ensure the Associated Domains match the host.
Submission : App Clips are reviewed together with the host app and must be included in the same Xcode project. As of iOS 14 the exact review guidelines are still being defined.
Sohu Tech Products
A knowledge-sharing platform for Sohu's technology products. As a leading Chinese internet brand with media, video, search, and gaming services and over 700 million users, Sohu continuously drives tech innovation and practice. We’ll share practical insights and tech news here.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.