This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@main | |
struct YourApp: App { | |
var body: some Scene { | |
let publisherBackground = NotificationCenter.default.publisher(for: UIApplication.willResignActiveNotification) | |
let publisherForeground = NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification) | |
return WindowGroup { | |
RootView() | |
.onReceive(publisherBackground) { _ in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
private protocol AnyOptional { | |
var isNil: Bool { get } | |
} | |
extension Optional: AnyOptional { | |
var isNil: Bool { self == nil } | |
} |
NewerOlder