Created
October 18, 2020 05:54
-
-
Save prafullakumar/04839e26347be5eddd8a2b80043294f5 to your computer and use it in GitHub Desktop.
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
// | |
// ios14_demoApp.swift | |
// ios14-demo | |
// | |
// Created by Prafulla Singh on 23/6/20. | |
// | |
import SwiftUI | |
@main | |
struct ios14_demoApp: App { | |
@Environment(\.scenePhase) var scenePhase | |
var body: some Scene { | |
WindowGroup { | |
ContentView() | |
}.onChange(of: scenePhase) { phase in | |
switch phase { | |
case .background: | |
print("App is in background") | |
case .active: | |
print("App is Active") | |
case .inactive: | |
print("App is Inactive") | |
@unknown default: | |
print("New App state not yet introduced") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment