Mac Catalyst

Hello everybody,

I am converting my iOS application to Mac Catalyst. In my iOS applications I have created an object UIDocument type. How can I import a document stored in the Mac Computer inside the Mac Catalyst application? Drag&Drop or other?

Thanks and regards,
Giordano

Replies

Preset document picker view

Code Block
let picker = DocumentPickerViewController(
supportedTypes: ["public.image", "png", "jpg", "jpeg", "tiff", "tif", "bmp", "bfm", "public.png", "public.jpeg", "customDoc"],
onPick: { url in
print("url : \(url)")
if url.pathExtension == "customDoc" {
self.importProject(fileURL: url)
}
else {
if (FileManager.default.fileExists(atPath: url.path)) {
if let image = UIImage(contentsOfFile: url.path){
self.importImage(image)
}
else {
print("ERROR loading image \(url.path)")
}
}
self.dismiss(animated: false)
}
},
onDismiss: {
print("dismiss")
})
present(picker, animated: false)


I haven't gotten drag and drop to work yet.
Drag and drop in Catalyst apps works the same way it does on iOS devices: using UIDragInteraction and UIDropInteraction.