TrioWatchApp.swift 436 B

12345678910111213141516171819
  1. import SwiftUI
  2. @main struct TrioWatchApp: App {
  3. @Environment(\.scenePhase) private var scenePhase
  4. var body: some Scene {
  5. WindowGroup {
  6. TrioMainWatchView()
  7. }
  8. .onChange(of: scenePhase) { _, newScenePhase in
  9. if newScenePhase == .background {
  10. Task {
  11. await WatchLogger.shared.flushPersistedLogs()
  12. }
  13. }
  14. }
  15. }
  16. }