Post

Replies

Boosts

Views

Activity

Open file directly into editor view with DocumentGroup
This was also raised in FB17028569 I have iOS document based app using DocumentGroup. I can create and save documents as expected. All that functionality is fine. @main struct FooBarApp: App { var body: some Scene { DocumentGroup(newDocument: { FoobarDocument() }) { config in MainView(document: config.document) } The problem is when I open an app document from Files.app or Messages the document is never opened directly into the editor, the document browser interface is always presented and the user must manually select the document to open an editor. This also happens when I use UIApplication.shared.requestSceneSessionActivation(nil, userActivity: activity, options: nil) to open a new scene. The doc isn't opened into my editor. I believe my plist document types are setup correctly and that my ReferenceFileDocument is setup correctly <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeExtensions</key> <array> <string>foobar</string> </array> <key>CFBundleTypeIconFile</key> <string>icon-128</string> <key>CFBundleTypeIconSystemGenerated</key> <integer>1</integer> <key>CFBundleTypeMIMETypes</key> <array> <string>application/json</string> </array> <key>CFBundleTypeName</key> <string>Foobar Project</string> <key>LSHandlerRank</key> <string>Owner</string> <key>LSItemContentTypes</key> <array> <string>com.digital-dirtbag.foobar</string> </array> <key>NSUbiquitousDocumentUserActivityType</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER).ubiquitousdoc</string> </dict> </array> <key>UTExportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <array> <string>public.data</string> </array> <key>UTTypeDescription</key> <string>Foobar Project</string> <key>UTTypeIconFiles</key> <array> <string>icon-128.png</string> </array> <key>UTTypeIdentifier</key> <string>com.digital-dirtbag.foobar</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>foobar</string> </array> </dict> </dict> The question is does DocumentGroup on iOS even support opening documents directly into the editor view? I know it works on macOS as expected as I tried this with the demo code and it exhibits the same symptoms. Opening a document from iOS Files.app only gets you as far as the document browser while macOS will open an editor directly.
Topic: UI Frameworks SubTopic: SwiftUI
0
0
43
May ’25
Open Document from Files App
What particular configuration will allow a document based app (DocumentGroup) to open the application into the selected document when the document is touched in Files.app. The sample code doesn't show this behaviour and instead will open the app but will not open the selected document. This also is the behaviour with the Xcode document based app template. Using LSSupportsOpeningDocumentsInPlace = YES in the plist does not make any difference. .onOpenURL is not a modifier on Scene only View and if the app is opened from cold the document view will not exist. In any case I would expect the DocumentGroup to open the document directly with no further intervention. What additional magic do I need to get a document to open directly from Files.app (or Messages) . For example Swift Playgrounds shows the correct behaviour, opening the selected project directly.
Topic: UI Frameworks SubTopic: SwiftUI
2
0
72
Mar ’25