Newly added ScenePhase not working with UIKit Lifecycle

First of all, is this the right place to report a SwiftUI bug? If so, keep reading. Otherwise, apologies for the misuse of this forum, I'd kindly ask where I can post this issue.

I'm testing ScenePhase as an environment variable along with onChange but I don't receive updates. I've created 2 projects from scratch with Xcode Beta choosing the different cycles:
  • UIKit lifecycle: onChange(scenePhase) just gets called on the first run with a wrong value.

  • SwiftUI lifecycle: onChange(scenePhase) gets successfully called with any change.

Code Block
struct ContentView: View {
    @Environment(\.scenePhase) var scenePhase
    var body: some View {
        Text("Hello, world!").padding()
            .onChange(of: scenePhase) { scenePhase in
                print("\(scenePhase)")
            }
    }
}

The code above prints background on startup. When switching to SwiftUI lifecycle it prints active.

Steps to reproduce
Xcode --> New --> Project --> UKit lifecycle

Replies

Two years later, sadly still doesn't work on XCode 14.2 / iOS 16.2 ...