ScenePhase Environment Variable in SwiftUI
SwiftUI
app moves from various phases of lifecycle and knowing about those phases can be helpful to make important decisions. ScenePhase
enum gives us access to three important phases of app lifecycle, active
, inactive
, and background
.
We can access ScenePhase
via Environment
variable and observe the change in scene to act accordingly.