Learn Courses My Dashboard

Hello, I am trying to move through views using a button without using NavigationView

Hi, I don’t seem to find out how to move through views by just using a simple button that’s not in a navigation view or anythings like that. I’ve tried using a .onTapGesture { SecondView() } but that gives me a warning saying “Result of ‘SecondView’ initializer is unused.” and when I run it it doesn’t do anything on being tapped. I’ve also tried using the simple Button(action: { SecondView() }, label: { Image(“Next View”) }) but as I said earlier the simple button gives the same warning as the .onTapGesture modifier did. Can someone please help me as I’m very stuck on this. Thanks!

you need to “present” the view not just call the class

how do I “present” the view?

these two links might help


Thank You Sooo Much! This Helped A Lot!

1 Like