@brandonK212 Thanks for the answer! For example, I download a usdz file using the command:
let fileUrl = URL(fileURLWithPath: "https://developer.apple.com/augmented-reality/quick-look/models/drummertoy/toy_drummer.usdz")
let entity = try? Entity.load(contentsOf: fileUrl)
Is this file saved to local iPhone storage? How can I access this file from code to open it in AR Quick Look?
Post
Replies
Boosts
Views
Activity
@brandonK212 Thanks for the answer! Two more questions: How to make sure that the file is loaded not when you open the application, but after clicking the button. So that when you click on a button, it loads and opens in turn?
How to make sure that after closing AR Quick Look these files are deleted from memory? I found the code but it doesn't seem to delete files!
@IBAction func removeAllFiles(){
let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
do {
let fileURLs = try FileManager.default.contentsOfDirectory(at: documentsUrl,
includingPropertiesForKeys: nil,
options: .skipsHiddenFiles)
for fileURL in fileURLs {
if fileURL.pathExtension == "usdz" {
try FileManager.default.removeItem(at: fileURL)
}
}
} catch { print(error) }
}