spb/poche Public
Agent personnel 100 % on-device — SwiftUI + Apple Foundation Models + EventKit + SwiftData. Aucune API, aucun serveur.
Swift 100%
1//2// RootView.swift3// Poche4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//89import SwiftUI10import FoundationModels1112/// Gates the whole app on model availability. Each unavailable state is13/// distinct and has its own message and action (CLAUDE.md §2).14struct RootView: View {15 @Environment(\.scenePhase) private var scenePhase16 @State private var availability = SystemLanguageModel.default.availability1718 var body: some View {19 Group {20 switch availability {21 case .available:22 ChatView()23 case .unavailable(let reason):24 AvailabilityView(reason: reason) {25 availability = SystemLanguageModel.default.availability26 }27 }28 }29 .onChange(of: scenePhase) { _, phase in30 // The user may enable Apple Intelligence in Settings and come back.31 if phase == .active {32 availability = SystemLanguageModel.default.availability33 }34 }35 }36}37