DEV Community

Saurabh Chavan
Saurabh Chavan

Posted on

2

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

Top comments (0)

Billboard image

📊 A side-by-side product comparison between Sentry and Crashlytics

A free guide pointing out the differences between Sentry and Crashlytics, that’s it. See which is best for your mobile crash reporting needs.

See Comparison

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay