You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
LeCountdown/LeCountdown/LeCountdownApp.swift

38 lines
971 B

//
// LeCountdownApp.swift
// LeCountdown
//
// Created by Laurent Morvillier on 20/01/2023.
//
import SwiftUI
@main
struct LeCountdownApp: App {
let persistenceController = PersistenceController.shared
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(AppEnvironment.sun)
.environment(\.managedObjectContext, persistenceController.container.viewContext)
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
self._willEnterForegroundNotification()
}.onAppear {
self._onAppear()
}
}
}
fileprivate func _willEnterForegroundNotification() {
AppEnvironment.sun.cleanup()
}
fileprivate func _onAppear() {
}
}