In the MainView, I have this below NaviationStack:
<code>.navigationDestination(for: String.self){ selection in
if(selection == "login"){
Login()
}else if(selection == "register"){
CreateAccount()
}
}
</code>
<code>.navigationDestination(for: String.self){ selection in
if(selection == "login"){
Login()
}else if(selection == "register"){
CreateAccount()
}
}
</code>
.navigationDestination(for: String.self){ selection in
if(selection == "login"){
Login()
}else if(selection == "register"){
CreateAccount()
}
}
In a sub view, I have this:
<code>NavigationLink(value: "login"){
Image(systemName: "person.circle.fill")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: profImgSize)
.foregroundColor(Color(UIColor(named: "IconColor")!))
}
</code>
<code>NavigationLink(value: "login"){
Image(systemName: "person.circle.fill")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: profImgSize)
.foregroundColor(Color(UIColor(named: "IconColor")!))
}
</code>
NavigationLink(value: "login"){
Image(systemName: "person.circle.fill")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: profImgSize)
.foregroundColor(Color(UIColor(named: "IconColor")!))
}
When I tap on it, I get:
Note: Links search for destinations in any surrounding NavigationStack, then within the same column of a NavigationSplitView.
A NavigationLink is presenting a value of type “String” but there is no matching navigationDestination declaration visible from the location of the link. The link cannot be activated.
When I create a minimal example, then it works and when I would post all the code here then it would be way too much. What could be the problem here?
1