Contents

DocumentLaunchView

A view to present when launching document-related user experience.

Declaration

struct DocumentLaunchView<Actions, DocumentView> where Actions : View, DocumentView : View

Overview

Configure DocumentLaunchView to open and display files and trigger custom actions.

For example, an application that offers writing books can present the DocumentLaunchView as its launch view:

public import UniformTypeIdentifiers

struct BookEditorLaunchView: View {

    var body: some View {
        DocumentLaunchView(for: [.book]) {
            NewDocumentButton("Start New Book")
        } onDocumentOpen: { url in
            BookEditor(url)
        }
    }
}

struct BookEditor: View {
    init(_ url: URL) { }
}

extension UTType {
    static let book = UTType(exportedAs: "com.example.bookEditor")
}

Topics

Initializers

Instance Properties

See Also

Configuring the document launch experience