Seeing weird sequences of changes when locking the screen when view is visable.
.onChange(of: scenePhase) { phase in
if phase == .active {
if UIApplication.shared.applicationState == .active {
print("KDEBUG: App genuinely became active")
} else {
print("KDEBUG: False active signal detected")
}
} else if phase == .inactive {
print("KDEBUG: App became inactive")
// Handle inactive state if needed
} else if phase == .background {
print("KDEBUG: App went to background")
// Handle background state if needed
}
}
seen:
(locks screen)
KDEBUG: App became inactive
KDEBUG: App genuinely became active
KDEBUG: App went to background
expected
(locks screen)
KDEBUG: App became inactive
KDEBUG: App went to background