Scrumdinger weird behaviour

I've been doing Scrumdinger SwiftUI tutorial and found strange behaviour. In this part "Managing State and Life Cycle" ( https://developer.apple.com/tutorials/app-dev-training/managing-state-and-life-cycle ) - Section 5 "Add Life Cycle Events" - after I implemented .onAppear{} and .onDisappear{} logic and run it on simulator - it instantly moves to 0-0 and "Last speaker" state. ( Tried to add some breakpoints @ ScrumTimer, but no luck - updateCalled several times and it stops.
BUT(!)
When I rotate my device( to landscape) or run it on iPad - everything works as excepted. To reproduce this behaviour you can simply download section 5 source code and run project from "Complete" folder. Can anyone help me to understand what is going on?

Answered by rojka in 678385022

For anyone who struggles like me : Add this

.navigationViewStyle(StackNavigationViewStyle())

to core navigation view - in our case that's App.

ScrumdingerApp.swift



@main

struct ScrumdingerApp: App {

    @State private var scrums = DailyScrum.data

    var body: some Scene {

        WindowGroup {

            NavigationView {

                ScrumsView(scrums: $scrums)

            }

            .navigationViewStyle(StackNavigationViewStyle())

        }

    }

}

Somehow it fixes everything 😃

Accepted Answer

For anyone who struggles like me : Add this

.navigationViewStyle(StackNavigationViewStyle())

to core navigation view - in our case that's App.

ScrumdingerApp.swift



@main

struct ScrumdingerApp: App {

    @State private var scrums = DailyScrum.data

    var body: some Scene {

        WindowGroup {

            NavigationView {

                ScrumsView(scrums: $scrums)

            }

            .navigationViewStyle(StackNavigationViewStyle())

        }

    }

}

Somehow it fixes everything 😃

Scrumdinger weird behaviour
 
 
Q