In Xcode beta 4 using PresentationLink gives the following warning: "'PresentationLink' is deprecated: Use .sheet modifier instead."
I'm assuming they mean some form of
func sheet<Content>(isPresented: Binding<Bool>, onDismiss: (() -> Void)? = nil, content: @escaping () -> Content) -> some View where Content : View
but I'm not to sure how to switch to this - in particular, the isPresented
argument is confusing me. I know there's an Environment variable called isPresented, but isn't that for the current View, not the View that's going to be presented?
I'm mostly interested in this because I'm hoping this will fix the issue with PresentationLinks only working once (see swiftUI PresentaionLink does not work second time)
Can anyone supply a simple example of how to present a view now that PresentationLink is deprecated? E.g., convert the following to use the .sheet modifier:
NavigationView {
List {
PresentationLink(destination: Text("Destination View")) {
Text("Source View")
}
}
}