SwiftUI Navigation

These are notes I’ve taken while watching the video of the corresponding session. They don’t have all the information contained in the video, but I’ve tried to still write the main points for my personal use cases.

Nest the view into a NavigationView to allow navigation.

Use navigationBarTitle to set a title for that specific view.

Use a NavigationButton to setup navigation if you want a button to push a new view into the navigation stack.

You can use navigationBarItems to create items/buttons on the navigation bar.

If for example we want a Tab (old UITabView):

struct ContentView: View { var body: some View { NavigationView{ TabbedView{ MainView() LogView().tabItemLabel{ Image(systemName: “clock.fill) } } } } }

Source: SwiftUI Essentials Getting Started with SwiftUI

Image

Valentino Urbano

iOS Developer, Swift, Writer, Husband

Back to Overview