-
-
Save anupamchugh/abf854ff3102165671aced546a0a80d4 to your computer and use it in GitHub Desktop.
This file contains 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 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