I used to be making an attempt to create a customized NavigationLink so I might change its look and likewise use it repeatedly like within the calling (second) code snippet.
I’ve outlined the customized NavigationLink like this:
NavigationStack {
NavigationLink(
vacation spot: linkDestination,
isActive: $isPressed,
label: {
Button(motion: {
isPressed = true
}) {
VStack {
Label(labelName, systemImage: icon)
.foregroundColor(.black)
}
.body(width: 200, top: 200)
.background(
RoundedRectangle(cornerRadius: 10)
.fill(colour)
)
}
.buttonStyle(CustomNavigationButtonStyle(isActive: isPressed))
}
)
}
It really works and is seen within the ContentView in the identical file because the view declaration but it surely’s they’re each invisible when calling it just like the under. Clearly it is totally different however I can not see something that will conceal them or make them invalid not directly.
I am calling it twice under.
Sorry upfront for not having full code snippets. It would not let me put up extra with out fluffing the non-code textual content:
...
VStack(spacing: 0) {
AppBar(title: "Votion")
.body(width: geometry.measurement.width, top: 44)
ScrollView {
VStack {
Spacer()
.padding(40.0)
Textual content("Create Activity")
.font(.title)
.foregroundColor(.black)
.padding()
CustomNavLink(
labelName: "Private",
icon: "individual",
linkDestination: PersonalTaskForm())
CustomNavLink(
labelName: "Enterprise",
icon: "laptopcomputer.and.iphone",
linkDestination: PersonalTaskForm())
}
}
}
...
Are you able to see any cause why each CustomNavLinks would not be seen?