How to show NavigationLink as a button in SwiftUI

后端 未结 8 2146
说谎
说谎 2021-01-31 14:39

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

8条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-31 15:19

    I don't know why all these answers are making this so complicated. In SwiftUI 2.0, you just add the button inside the navigation link!

    NavigationLink(destination: TimerView()) {
        Text("Starten")
    }
    

    You can apply SwiftUI styling to the Text object just as you would style any other element.

提交回复
热议问题