My document-based app supports several different file types. It is currently written in SwiftUI using a UIDocumentBrowserViewController. I'm trying to convert to the new SwiftUI (v2) DocumentGroup paradigm. I need to let the user pick which kind of document to create when they tap the Create button in the document browser. Using DocumentGroup paradigm, I don't see how this is possible. When you create a DocumentGroup, you have to specify the document right there:
When using UIKit, the browser calls a delegate function didRequestDocumentCreationWithHandler that lets the app inject some UI for picking a document type, before proceeding on. In fact, what you can do is provide the document browser with a template file to be used for creating the new doc. Is that possible in SwiftUI 2?
Code Block var body: some Scene { DocumentGroup(newDocument: TextDocument()) { file in TextDocumentEditor(document: file.$document) } }
When using UIKit, the browser calls a delegate function didRequestDocumentCreationWithHandler that lets the app inject some UI for picking a document type, before proceeding on. In fact, what you can do is provide the document browser with a template file to be used for creating the new doc. Is that possible in SwiftUI 2?