Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Created June 26, 2020 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupamchugh/abf854ff3102165671aced546a0a80d4 to your computer and use it in GitHub Desktop.
Save anupamchugh/abf854ff3102165671aced546a0a80d4 to your computer and use it in GitHub Desktop.
@main
struct MyApp: App {
@Environment(\.scenePhase) private var scenePhase
var body: some Scene {
WindowGroup {
ContentView()
}
.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