Swift package that takes the pain out of implementing Quick Look previews
- iOS 13+
- macOS 11+
Add QuickLooking to your Swift Package dependencies and import it where needed
import QuickLookingPresent QuickLookView with a file URL
import SwiftUI
import QuickLooking
struct ContentView: View {
@State private var showPreview = false
let fileURL: URL
var body: some View {
Button("Preview") {
showPreview = true
}
.sheet(isPresented: $showPreview) {
QuickLookView(fileURL)
}
}
}Use .quickLookPreview with a binding and URL
import SwiftUI
import QuickLooking
struct ContentView: View {
@State private var showPreview = false
let fileURL: URL
var body: some View {
Button("Preview") {
showPreview = true
}
.quickLookPreview($showPreview, url: fileURL)
}
}Optional parameter on macOS:
blur: adds a blur overlay in the preview panel whentrue