Document-based app using FileDocument and DocumentGroup: Pick a document type first

Viewed 15

I am using the following approach to create my Document. It works. Except, I would like to ask the user which kind of document to create first, for example by using a button sheet ...

    import SwiftUI

@main
struct TextEdit_it_iOSApp: App {
    var body: some Scene {
        
        
        
        DocumentGroup(newDocument: TextEdit_it_iOSDocument() ) {
            
            file in
            ContentView(document: file.$document, fileURL: URL(string: "/")!, fileTypeAttribute: "", fileSizeAttribute: 0, fileTitleAtribute: "", fileCreatedAttribute: Date(), fileModifiedAttribute: Date(), fileExtensionAttribute: "", fileOwnerAttribute: "", fileNameAttribute: "", filePathAttribute: "")
        }
    }
    
    
}

Any tipps and tricks ?

0 Answers
Related