The linked answer isn't quite up to date and doesnt connect to a SwiftUI DocumentGroup
Add a UIApplicationDelegate via @UIApplicationDelegateAdaptor
Programmatically add a UISceneDelegate in the UIApplicationDelegate in
func application(
_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions
) -> UISceneConfiguration {
let sceneConfig: UISceneConfiguration = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role)
sceneConfig.delegateClass = MySceneDelegate.self
return sceneConfig
}
This is where it differs from the linked answer. In the UISceneDelegate implement
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
if let url = URLContexts.first?.url {
// How to get `DocumentGroup` to open url in its scene context ???
}
}
Where you could use MyUIDocument().open() in a UIKit context, FileDocument / ReferenceFileDocument doesn't have a corresponding open method.
Thanks
Topic:
UI Frameworks
SubTopic:
SwiftUI