I´m creating an App and use NavigationLink in Swift/SwiftUI, but it doesn't work anymore. I don't now since when, but 2 or 3 weeks ago, all working fine. The NavigationLinks which already are in the code for longer, working fine. But today I've used new ones, and they don´t work. It looks in the Simulator and on a real device, if they are disabled or something. They are grey and you can't click on them or if you clicked on them, nothing happens. Is there any solution?
import SwiftUI
struct MedikamenteView: View {
var body: some View {
Form {
NavigationLink(
destination: ASSView(),
label: {
Text("ASS")
})
NavigationLink(
destination: AdrenalinView(),
label: {
Text("Adrenalin")
})
}
}
}
struct MedikamenteView_Previews: PreviewProvider {
static var previews: some View {
MedikamenteView()
}
}
And for example, this one is working fine:
import SwiftUI
struct RechtView: View {
var body: some View {
Form {
NavigationLink(
destination: ParagraphenView(),
label: {
Text("Paragraphen")
})
NavigationLink(
destination: AufklaerungEinwilligungView(),
label: {
Text("Die Aufklärung mit nachfolgender Einwilligung")
})
NavigationLink(
destination: NotSanGView(),
label: {
Text("Wichtiges aus dem NotSanG")
})
}
.navigationTitle("Recht")
}
}
struct RechtView_Previews: PreviewProvider {
static var previews: some View {
RechtView()
}
}
RechtViewlook like? If it contains aNavigationViewthenRechtViewis within aNavigationViewand your links will work. If you trace back up the view hierarchy, I'm sure you will find aNavigationViewsomewhere and that'll be the difference.