.onAppear print not working

Hi,

I have the following code:

struct Loading: View {
    var body: some View {
        Text("Loading...")
            .onAppear {
                print("test")
            }
    }
}

The view is on the screen, however the print statement doesn't run. Why would this be? Any help would be greatly appreciated.

Answered by Claude31 in 798595022

I tested your code on simulator in Xcode 16.0ß2 and it works correctly (test is printed).

Have you checked that the console is visible. Check the lower right icons in Xcode which should be like this:

Accepted Answer

I tested your code on simulator in Xcode 16.0ß2 and it works correctly (test is printed).

Have you checked that the console is visible. Check the lower right icons in Xcode which should be like this:

.onAppear print not working
 
 
Q