Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
struct MyApp: App {
@Environment(\.scenePhase) private var scenePhase
var body: some Scene {
WindowGroup {
.onChange(of: scenePhase) { phase in
if phase == .background {
//perform cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment