I am trying to use the view modifier .quickLookPreview
introduced in iOS 14, macOS 11 macCatalyst 14 but I get this error Value of type 'some View' has no member 'quickLookPreview'
every time I try to use the modifier on a macOS or mac catalyst target. On iOS, this works fine.
What is the right way to present this modifier on a mac?
import SwiftUI
import QuickLook
struct ContentView: View {
@State var documentUrl: URL?
var body: some View {
NavigationView {
ZStack {
Button("Press Me", action: {
documentUrl = URL(fileURLWithPath: "somelocalfileURLPath")
})
}
.navigationTitle("Open File")
.quickLookPreview($documentUrl)
}
}
}
xcode 13.1 MacOS 12.1
The issue is gone now in Xcode 13.2
So the right way to use the modifier is valid, it was just probably some bug in earlier xcode versions.