// // RootView.swift // Poche // // Author: Simon-Pierre Boucher // Contact: contact@spboucher.ai // import SwiftUI import FoundationModels /// Gates the whole app on model availability. Each unavailable state is /// distinct and has its own message and action (CLAUDE.md ยง2). struct RootView: View { @Environment(\.scenePhase) private var scenePhase @State private var availability = SystemLanguageModel.default.availability var body: some View { Group { switch availability { case .available: ChatView() case .unavailable(let reason): AvailabilityView(reason: reason) { availability = SystemLanguageModel.default.availability } } } .onChange(of: scenePhase) { _, phase in // The user may enable Apple Intelligence in Settings and come back. if phase == .active { availability = SystemLanguageModel.default.availability } } } }