Go from one screen to another in SwiftUI

100rabhcsmc

Saurabh Chavan

Posted on March 27, 2023

Go from one screen to another in SwiftUI

In this post we will be explore how can we navigate from one screen to another using the NavigationLink

import SwiftUI


struct ContentView: View {
    var body: some View {
        NavigationView {
            List(1..<30){ row in
                NavigationLink{
                    Text("Details \(row)")
                } label: {
                    Text("Row \(row)")
                }

            }
            .navigationTitle("SwiftUI")
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
Enter fullscreen mode Exit fullscreen mode

Output

Image description

💖 💪 🙅 🚩
100rabhcsmc
Saurabh Chavan

Posted on March 27, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Go from one screen to another in SwiftUI
100daysofcode Go from one screen to another in SwiftUI

March 27, 2023

model show on click in swiftUI
100daysofcode model show on click in swiftUI

March 24, 2023

confirmationDialog() in swiftUI
100daysofcode confirmationDialog() in swiftUI

March 24, 2023