Contents

callAsFunction(contentType:)

Presents a new document window.

Declaration

@MainActor @preconcurrency func callAsFunction(contentType: UTType)

Parameters

  • contentType:

    The content type of the document.

Discussion

Don’t call this method directly. SwiftUI calls it when you call the newDocument action:

newDocument(contentType: .todoList)

 extension UTType {
     static let todoList = UTType(exportedAs: "com.myApp.todoList")
 }

For information about how Swift uses the callAsFunction() method to simplify call site syntax, see Methods with Special Names in The Swift Programming Language.

See Also

Calling the action