I want to show a file picker for choosing a "save to file" location on iOS. The UIDocumentViewPickerController
offers the method initWithURL:inMode:
(https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller/1618684-initwithurl?language=objc) for saving files but it requires an url to a local file. Instead I want to get a file handle to which the data is written after picking. Does iOS offer such a function, or do I have to create a temporary local file first and then use the initWithURL
method?
Regards,
iOS 13 offers means for picking directories (https://developer.apple.com/documentation/uikit/view_controllers/providing_access_to_directories). It is possible to create new items as well.
// Create a document picker for directories.
let documentPicker =
UIDocumentPickerViewController(documentTypes: [kUTTypeFolder as String],
in: .open)