Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SwiftUI PresentationButton Stops Functioning After Single Use on watchOS

Tags:

swiftui

The PresentationButton presents the view properly, but upon hitting "Cancel" to return to parent view, the button refuses to present the child view again.

Here is my PresentationButton code:

struct ContentView : View {
    var body: some View {
        ZStack {

            PresentationButton(Text("Click to show"), destination: SomeOtherView())
                .transition(.slide)
        }
    }
}
like image 963
Isaac Avatar asked Nov 06 '22 16:11

Isaac


1 Answers

This bug has existed in various forms until Xcode 11 beta 4, but note that the API has changed.

PresentationButton became PresentationLink and then was deprecated in Xcode 11 beta 4 in favor of .sheet.

See here for an example of how to use the new functionality: https://stackoverflow.com/a/57087399/3179416

like image 61
Zain Avatar answered Jan 01 '23 22:01

Zain