App Clip Fundamentals
What Are App Clips?
App Clips are lightweight versions of your app that launch quickly for specific tasks. Users can access them without downloading the full app.
Size Limits
App Clips have strict size constraints:
| Platform | Limit |
|---|---|
| iOS | 15 MB |
| macOS | 15 MB |
| WatchOS | 10 MB |
When to Use App Clips
- Ordering food at a restaurant
- Parking a rental car
- Checking in at a hotel
- Quick product scanning
- Transit ticket purchases
App Clip Target Setup
- Open your Xcode project
- File > New > Target > App Clip
- Configure the App Clip bundle identifier
- Set up the App Clip entry point
Entry Points
App Clips can be launched via:
- App Clip Cards (NFC, QR codes, links)
- Maps integration
- Safari and Messages
- Siri Suggestions
App Clip Cards and Invites
App Clip Cards
App Clip Cards are physical or digital cards that launch your App Clip:
import AppClips
func createAppClipCard() -> AppClipLink {
let config = AppClipLink(
url: URL(string: "https://yourapp.com/clip/order")!,
metadata: AppClipLink.Metadata(
title: "Quick Order",
subtitle: "Order ahead at our restaurant",
image: URL(string: "https://yourapp.com/images/card.png")
)
)
return config
}
Invites API
Allow users to share App Clips with others:
import AppClips
func shareAppClip() {
let clip = AppClip(
url: URL(string: "https://yourapp.com/clip/order")!,
metadata: AppClip.Metadata(
title: "Quick Order",
subtitle: "Order ahead"
)
)
let invitation = AppClip Invitation(clip: clip)
// Present share sheet
}
NFC Tags
Launch App Clips from physical locations:
- Program NFC tags with your App Clip URL
- Place tags at point of sale
- Users tap their iPhone to launch
QR Codes
Generate QR codes that link to your App Clip:
func generateQRCode(for url: URL) -> UIImage {
let data = url.absoluteString.data(using: .ascii)
guard let filter = CIFilter(name: "CIQRCodeGenerator") else { return UIImage() }
filter.setValue(data, forKey: "inputMessage")
guard let image = filter.outputImage else { return UIImage() }
return UIImage(ciImage: image)
}
App Clip Lifecycle
Launching an App Clip
App Clips have a limited runtime and memory footprint:
@main
struct MyAppClip: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Communicating with the Main App
App Clips can pass data to the full app via App Groups:
// In App Clip
let sharedDefaults = UserDefaults(suiteName: "group.com.yourapp")
sharedDefaults?.set(orderID, forKey: "pendingOrderID")
// In Main App
let sharedDefaults = UserDefaults(suiteName: "group.com.yourapp")
if let orderID = sharedDefaults?.string(forKey: "pendingOrderID") {
// Process the order
}
App Clip Limits
- Maximum 3 App Clip invocations per day per user
- Limited memory and CPU
- No background execution
- No push notifications
- Limited HealthKit and HomeKit access
Converting to Full App
Encourage users to download the full app:
import SafariServices
func openAppStore() {
let url = URL(string: "https://apps.apple.com/app/id123456")!
UIApplication.shared.open(url)
}
Best Practices
- Keep the App Clip focused on one task
- Design for quick completion (under 30 seconds)
- Use App Groups for data sharing
- Test on physical devices only
- Monitor App Clip analytics in App Store Connect
Quiz
1. What is the maximum size for an iOS App Clip?
2. How many times can an App Clip be invoked per day per user?
3. How do App Clips share data with the main app?
4. Which of the following is NOT an App Clip entry point?
Flashcards
Question
What is the maximum size for an iOS App Clip?
Click to reveal answer
Answer
15 MB for iOS App Clips.
Question
How do App Clips share data with the full app?
Click to reveal answer
Answer
Through App Groups shared containers using UserDefaults or file storage.
Question
What are App Clip entry points?
Click to reveal answer
Answer
NFC tags, QR codes, Safari links, Maps integration, and Siri Suggestions.
Revision Notes
Key Takeaways
- 1. App Clips are lightweight 15 MB versions of your app
- 2. They have limited invocations per day per user
- 3. Use App Groups to share data between App Clip and main app
- 4. App Clips should complete a single task in under 30 seconds
Interview Tips
- • Explain when App Clips are appropriate vs full app downloads
- • Describe how App Clips communicate with the main app
- • Discuss the limitations of App Clips compared to full apps
- • Know the entry points and size constraints
Cheat Sheet
App Clips Quick Reference
- Size limit: 15 MB (iOS)
- 3 invocations per day per user
- Entry points: NFC, QR, links, Maps
- Data sharing via App Groups
- No push notifications
- Focus on single quick task