BusinessCard/BusinessCardWatch Watch App/BusinessCardWatchApp.swift

24 lines
531 B
Swift

import SwiftUI
@main
struct BusinessCardWatchApp: App {
@State private var cardStore = WatchCardStore()
init() {
// Wire up WatchConnectivity to receive cards from iPhone
let store = cardStore
WatchConnectivityService.shared.onCardsReceived = { cards in
Task { @MainActor in
store.updateCards(cards)
}
}
}
var body: some Scene {
WindowGroup {
WatchContentView()
.environment(cardStore)
}
}
}