I"m trying to create a simple app for my students that will display .heic images taken with a nikon and them converted to .heic in the photos app. My attempts only result in the QuickLook viewer showing the images in 2d. Any guidance? Here is my ContentView:
import SwiftUI
import QuickLook
struct ContentView: View {
@State private var showQuickLook = false
@State private var previewURL: URL? = nil // State to store the URL for Quick Look
var body: some View {
VStack {
Button("See it in 3D") {
// Set the URL for the file from the bundle and toggle Quick Look presentation
if let imageURL = Bundle.main.url(forResource: "Michelia_fuego", withExtension: "heic") {
previewURL = imageURL // Set the preview URL if the image is found
showQuickLook.toggle() // Toggle to trigger Quick Look presentation
} else {
print("File not found") // Print error if the file is missing
}
}
.quickLookPreview($previewURL) // Binding to the URL
}
}
}
#Preview {
ContentView()
}