import SwiftUI
struct ContentView: View {
var body: some View {
NavigationLink(destination: DetailView()) {
Text("Show Details")
}
}
}
struct DetailView: View {
var body: some View {
Text("Detailed")
}
}
This code gives me a gray text (or button) saying 'Show Details' which is not touchable and does not perform the intended action (navigating to DetailView
). Was there a change in the API or is it a bug?
I am using the newest versions of Xcode (Xcode 11 Beta 6 and macOS Catalina 10.15 Beta 6)
Your ContentView should have a NavigationView for NavigationLink to work, and be enclosed in some 'element', here a VStack
struct ContentView: View {
var body: some View {
NavigationView {
VStack {
NavigationLink(destination: DetailView()) {
Text("Show Details")
}
}
}
}
}
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With