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
QuickLook
import. Now it works. For reference, the deleted comment: "It doesn't work for me on Xcode 13.3, I tried the code example above, and get the same Value of type 'some View' has no member 'quickLookPreview'. I tried it both in a MacOS and an iOS project, with several of the latest versions as deployment targets." – Reminiscence