Skip to content

Instantly share code, notes, and snippets.

@prafullakumar
Created October 18, 2020 05:54
Show Gist options
  • Save prafullakumar/04839e26347be5eddd8a2b80043294f5 to your computer and use it in GitHub Desktop.
Save prafullakumar/04839e26347be5eddd8a2b80043294f5 to your computer and use it in GitHub Desktop.
//
// 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