iOS 18 .onChange(of: scenePhase) is constantly triggered

Hey all,

I am facing a new issue on iOS 18 with ScenePhase and .onChange modifier.

Here's roughly the code:

.onChange(of: scenePhase, initial: true) { old, new in 
    if new == .active {
       doStuff()
    }
}

on iOS 17 this was working as expected and triggered when eg. ap was brough from background or user navigated back to view

on ios18 though this code gets triggered constatnly in my case when I eg. navigate to another screen on top of the one with that .onChange. after navigation happens, the onChange is being triggered continuosly and does not stop which causes doStuff() to be called multiple times

I suspect this is somehow related to new fix in ios 18:

Fixed: App scenePhase now reports as active when at least one scene is active. (117864591)

unfortunatley I was not able to find the original issue descri-tion

iOS 18 .onChange(of: scenePhase) is constantly triggered
 
 
Q