init(viewing: Document.Type, viewer: (FileDocumentConfiguration <Document>) -> Content)
Document
conforms to FileDocument
and Content
conforms to View
.
Document
がFileDocument
に準拠する、そしてContent
がView
に準拠する場合に利用可能です。
Availability 有効性
Technology
init(newDocument: @autoclosure @escaping () -> Document, editor: @escaping (FileDocumentConfiguration
<Document>) -> Content)
Document
conforms to FileDocument
and Content
conforms to View
.
Document
がFileDocument
に準拠する、そしてContent
がView
に準拠する場合に利用可能です。
newDocument
The initial document to use when a user creates a new document.
editor
The editing UI for the provided document.
Use a Document
scene to tell SwiftUI what kinds of documents your app can open when you declare your app using the App
protocol. You initialize a document group scene by passing in the document model and a view capable of displaying the document’s contents. The document types you supply to Document
must conform to File
or Reference
. SwiftUI uses the model to add document support to your app. In macOS this includes document-based menu support including the ability to open multiple documents. In iOS this includes a document browser that can navigate to the documents stored on the file system and multiwindow support:
@main
struct MyApp: App {
var body: some Scene {
DocumentGroup(newDocument: TextFile()) { file in
ContentView(document: file.$document)
}
}
}
The document types you supply to Document
must conform to File
or Reference
. Your app can support multiple document types by adding additional Document
scenes.
init(viewing: Document.Type, viewer: (FileDocumentConfiguration <Document>) -> Content)
Document
conforms to FileDocument
and Content
conforms to View
.
Document
がFileDocument
に準拠する、そしてContent
がView
に準拠する場合に利用可能です。