5

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)
        }
    }
}
Isaac
  • 645
  • 1
  • 7
  • 17
  • 4
    This seems to be a bug in the current version. I don't see any relevant bugs registered at https://bugs.swift.org, but someone mentioned here (https://www.reddit.com/r/swift/comments/by2a1r/swiftui_modal_presentation_bug/?ref=readnext) that this was reported to Apple engineers and they acknowledged it. – Arun Reddy Jun 08 '19 at 22:25
  • 5
    Its just not watchOS. On iOS also, its buggy. – SMP Jun 09 '19 at 02:16

1 Answers1

1

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

Zain
  • 1,569
  • 1
  • 13
  • 19