[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
---
|
||||
id: ios-app-clips
|
||||
title: iOS App Clips — 10MB 미만 즉시 실행
|
||||
category: Coding
|
||||
status: draft
|
||||
source_trust_level: B
|
||||
verification_status: conceptual
|
||||
created_at: 2026-05-09
|
||||
updated_at: 2026-05-09
|
||||
tags: [ios, app-clip, vibe-coding]
|
||||
tech_stack: { language: "Swift / SwiftUI", applicable_to: ["iOS 14+"] }
|
||||
applied_in: []
|
||||
aliases: [App Clip, App Clip Code, invocation URL, Smart App Banner]
|
||||
---
|
||||
|
||||
# iOS App Clips
|
||||
|
||||
> 앱 설치 없이 한 기능만 즉시 실행. **10MB 미만 binary**. QR / NFC / 링크로 진입. 테이블 결제 / 주차 / 자전거 대여 같은 즉시성 시나리오.
|
||||
|
||||
## 📖 핵심 개념
|
||||
- App Clip Target: 메인 앱 안의 Extension target.
|
||||
- Invocation URL: `https://example.com/order/123` 같은 URL → App Clip 호출.
|
||||
- Sign in with Apple, Apple Pay, push notifications 사용 가능.
|
||||
- 메인 앱과 App Group / Keychain 공유.
|
||||
|
||||
## 💻 코드 패턴
|
||||
|
||||
### App Clip target — Info.plist
|
||||
```xml
|
||||
<key>NSAppClip</key>
|
||||
<dict>
|
||||
<key>NSAppClipRequestEphemeralUserNotification</key>
|
||||
<true/>
|
||||
<key>NSAppClipRequestLocationConfirmation</key>
|
||||
<false/>
|
||||
</dict>
|
||||
```
|
||||
|
||||
### Invocation URL handling
|
||||
```swift
|
||||
@main
|
||||
struct MyAppClip: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { activity in
|
||||
guard let url = activity.webpageURL else { return }
|
||||
handleInvocation(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func handleInvocation(_ url: URL) {
|
||||
// 예: https://example.com/order/123
|
||||
let components = url.pathComponents
|
||||
if components.count >= 3, components[1] == "order" {
|
||||
let orderId = components[2]
|
||||
store.loadOrder(orderId)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Apple-App-Site-Association
|
||||
```json
|
||||
// https://example.com/.well-known/apple-app-site-association
|
||||
{
|
||||
"appclips": {
|
||||
"apps": ["TEAMID.com.example.MyApp.Clip"]
|
||||
},
|
||||
"applinks": {
|
||||
"details": [{ "appIDs": ["TEAMID.com.example.MyApp"], "components": [{ "/": "/order/*" }] }]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### App Clip → Full app upgrade prompt
|
||||
```swift
|
||||
import StoreKit
|
||||
|
||||
let overlay = SKOverlay.AppClipConfiguration(position: .bottom)
|
||||
SKOverlay(configuration: overlay).present(in: scene)
|
||||
```
|
||||
|
||||
### 메인 앱과 데이터 공유 (App Group)
|
||||
```swift
|
||||
let defaults = UserDefaults(suiteName: "group.com.example.shared")
|
||||
defaults?.set(orderId, forKey: "lastOrder")
|
||||
// Full 앱 설치 후 같은 group 통해 이어서
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준
|
||||
| 시나리오 | App Clip 적합 |
|
||||
|---|---|
|
||||
| 1회성 결제 (테이블 / 주차) | ✅ |
|
||||
| 자전거 / 스쿠터 대여 | ✅ |
|
||||
| 메뉴 보기 (식당) | ✅ |
|
||||
| 회원 가입 필수 + 복잡 | ❌ — Full 앱 |
|
||||
| 큰 콘텐츠 (이미지 다수) | ❌ — 10MB 한계 |
|
||||
| 오프라인 사용 | ❌ — 임시 |
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **10MB 초과**: 빌드 fail. asset 최소화.
|
||||
- **메인 앱 코드 통째 공유**: 빌드 시 size 폭증. shared framework 만 필요한 부분.
|
||||
- **invocation URL 가정**: 항상 `Smart Banner` 또는 QR 으로 진입 가능. URL parameter 검증.
|
||||
- **사용자 정보 영구 저장 가정**: App Clip 은 임시. 메인 앱 설치 유도.
|
||||
- **풀 기능 흉내**: 한 핵심 task 만.
|
||||
- **NFC tag 안 테스트**: real device 필수.
|
||||
|
||||
## 🤖 LLM 활용 힌트
|
||||
- 한 task = 한 App Clip. invocation URL 명확.
|
||||
- 메인 앱과 App Group 으로 연속성.
|
||||
|
||||
## 🔗 관련 문서
|
||||
- [[iOS_Universal_Links_Deep_Linking]]
|
||||
- [[iOS_Widget_Extension]]
|
||||
Reference in New Issue
Block a user