How to accept CloudKit shares with the new SwiftUI app lifecycle?

In the iOS 13 world, I had code like this:

Code Block
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) {
// do stuff with the metadata, eventually call CKAcceptSharesOperation
}
}


I am migrating my app to the new SwiftUI app lifecycle, and can’t figure out where to put this method. It used to live in AppDelegate pre-iOS13, and I tried going back to that, but the AppDelegate version never gets called.

There doesn’t seem to be a SceneDelegateAdaptor akin to UIApplicationDelegateAdaptor available, which would provide a bridge to the old code.

So, I’m lost. How do I accept CloudKit shares with SwiftUI app lifecycle? 🙈

Replies

I second that. Would love to know...
I am working on a cross platform app and using the app lifecycle across all platforms would be great. Since I can’t do that, my current plan is to keep using the new lifecycle on macOS, but fall back to iOS 13 way on iOS until there is a way to accept CloudKit shares in the new lifecycle.