docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거

Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,197 @@
---
id: ios-watchos-patterns
title: watchOS — Watch app / 복잡도 제한 / 통신
category: Coding
status: draft
source_trust_level: B
verification_status: conceptual
created_at: 2026-05-09
updated_at: 2026-05-09
tags: [ios, watchos, vibe-coding]
tech_stack: { language: "Swift / SwiftUI / WatchConnectivity", applicable_to: ["watchOS"] }
applied_in: []
aliases: [watchOS, Apple Watch, complications, WatchConnectivity, WCSession]
---
# watchOS
> 단순 + 빠른. **30초 이상 화면 X**. SwiftUI 표준. iPhone ↔ Watch 통신 = WatchConnectivity. Complications + smart stack 이 진짜 가치.
## 📖 핵심 개념
- App: short interaction (10-30초).
- Complication: 시계 face 의 작은 데이터.
- Smart Stack: 위젯처럼 timeline.
- Connectivity: iPhone 과 데이터 공유.
## 💻 코드 패턴
### Watch app 구조
```swift
@main
struct WatchApp: App {
var body: some Scene {
WindowGroup {
NavigationStack {
HomeView()
}
}
}
}
struct HomeView: View {
@StateObject var vm = HomeViewModel()
var body: some View {
List(vm.items) { item in
NavigationLink(value: item) {
HStack { Image(systemName: "clock"); Text(item.name) }
}
}
.navigationDestination(for: Item.self) { ItemDetail($0) }
}
}
```
### Complication (WidgetKit, watchOS 9+)
```swift
struct WatchComplication: Widget {
var body: some WidgetConfiguration {
StaticConfiguration(kind: "step", provider: StepProvider()) { entry in
Text("\(entry.steps)")
.containerBackground(.fill.tertiary, for: .widget)
}
.supportedFamilies([
.accessoryCircular,
.accessoryCorner,
.accessoryInline,
.accessoryRectangular,
])
}
}
```
```swift
struct StepEntry: TimelineEntry {
let date: Date
let steps: Int
}
struct StepProvider: TimelineProvider {
func placeholder(in context: Context) -> StepEntry { StepEntry(date: Date(), steps: 0) }
func getSnapshot(in context: Context, completion: @escaping (StepEntry) -> Void) { ... }
func getTimeline(in context: Context, completion: @escaping (Timeline<StepEntry>) -> Void) {
// entries
}
}
```
### WatchConnectivity (iPhone ↔ Watch)
```swift
import WatchConnectivity
class WCManager: NSObject, ObservableObject, WCSessionDelegate {
static let shared = WCManager()
override init() {
super.init()
if WCSession.isSupported() {
WCSession.default.delegate = self
WCSession.default.activate()
}
}
func session(_ session: WCSession, activationDidCompleteWith state: WCSessionActivationState, error: Error?) {}
// Receiving
func session(_ session: WCSession, didReceiveMessage message: [String: Any]) {
//
}
func session(_ session: WCSession, didReceiveApplicationContext applicationContext: [String: Any]) {
// sync
}
}
//
WCSession.default.sendMessage(["action": "fetch"], replyHandler: { reply in
//
}, errorHandler: { e in print(e) })
// application context (latest snapshot)
try WCSession.default.updateApplicationContext(["count": 42])
```
### Workout / HealthKit
```swift
import HealthKit
let store = HKHealthStore()
let config = HKWorkoutConfiguration()
config.activityType = .running
config.locationType = .outdoor
let session = try HKWorkoutSession(healthStore: store, configuration: config)
let builder = session.associatedWorkoutBuilder()
session.startActivity(with: Date())
// ... data collection
session.end()
try await builder.endCollection(at: Date())
let workout = try await builder.finishWorkout()
```
### Always-On Display (AOD)
```swift
@Environment(\.scenePhase) var scenePhase
// scenePhase = .background AOD
// ( )
.scenePhaseAware { phase in
if phase == .background {
// dim,
}
}
```
### Crown rotation
```swift
@State var value: Double = 0
ScrollView {
Text("\(value)").focusable()
.digitalCrownRotation($value, from: 0, through: 100, by: 1, sensitivity: .medium, isContinuous: false)
}
```
### Notification (rich)
```swift
class NotificationController: WKUserNotificationHostingController<NotificationView> {
override var body: NotificationView { NotificationView() }
}
```
## 🤔 의사결정 기준
| 상황 | 권장 |
|---|---|
| 단순 viewer | Complication + Smart Stack |
| 짧은 입력 | 음성 / digital crown |
| 운동 추적 | HealthKit + WorkoutSession |
| iPhone 의존 데이터 | WatchConnectivity + applicationContext |
| 대용량 동기화 | transferUserInfo / file |
| 알림 풍부 | Custom notification view |
## ❌ 안티패턴
- **iOS UI 직접**: 화면 작음 — 단순화.
- **30초 이상 작업**: 화면 sleep. background task.
- **Always-on 무절제 데이터**: 배터리. dim mode.
- **WCSession.sendMessage 큼**: 작은 ping 만. context 사용.
- **Complication 매분 갱신**: 배터리. 시간별.
- **Health permission 미설명**: deny 자주.
- **Crown 무시**: 핵심 입력. 활용.
## 🤖 LLM 활용 힌트
- SwiftUI + WidgetKit (Complication) + WCSession 3종.
- HealthKit 표준.
- 짧고 단순 + Always-On 고려.
## 🔗 관련 문서
- [[iOS_SwiftUI_State_Property_Wrappers]]
- [[iOS_Widget_Extension]]
- [[iOS_Background_Tasks]]