I\'ve read a lot here about navigation in SwiftUI and tried a couple of things, but nothing is working as desired.
Basically, I have a view with a list of workouts and y
I've been playing around with this for a few days myself. I think this is what you're looking for.
struct WorkoutDetail: View {
var workout: Workout
var body: some View {
NavigationView {
VStack {
NavigationLink(destination: TimerView()) {
ButtonView()
}.navigationBarTitle(Text(workout.title))
}
}
}
And create a View you want to show in the NavigationLink
struct ButtonView: View {
var body: some View {
Text("Starten")
.frame(width: 200, height: 100, alignment: .center)
.background(Color.yellow)
.foregroundColor(Color.red)
}
Note: Anything above the NavigationView appears to show up on all pages in the Navigation, making the size of the NavigationView Smaller in the links.