feat(ios): UIScene Support#8536
Conversation
| var window: UIWindow? | ||
|
|
||
| func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | ||
| SceneDelegateProxy.shared.scene(scene, willConnectTo: session, options: connectionOptions) |
There was a problem hiding this comment.
Why doesn't this one need all the UIWindow stuff?
There was a problem hiding this comment.
We can probably use this same logic for the pods-template SceneDelegate right? that way we aren't overriding the window?
| ]) | ||
| } | ||
|
|
||
| // TODO: Not until Phase 2 of the UI modernization project |
There was a problem hiding this comment.
Shipping this with 9? Or just later in 8.
There was a problem hiding this comment.
Ah yes, I'll remove these comments for now. The planned UI modernization is "planned" for 10, but im pushing for 9.
Either way these can be removed for the time being.
| var window: UIWindow? | ||
|
|
||
| func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | ||
| SceneDelegateProxy.shared.scene(scene, willConnectTo: session, options: connectionOptions) |
There was a problem hiding this comment.
We can probably use this same logic for the pods-template SceneDelegate right? that way we aren't overriding the window?
| if !connectionOptions.urlContexts.isEmpty { | ||
| self.scene(scene, openURLContexts: connectionOptions.urlContexts) | ||
| } | ||
|
|
||
| for userActivity in connectionOptions.userActivities { | ||
| self.scene(scene, continue: userActivity) | ||
| } |
There was a problem hiding this comment.
Found one more gap when testing the @capacitor/app plugin with cold-start deep links. They never reach the appUrlOpen listener. I believe this is because the URL arrives before the bridge has fully loaded.
This fix suggested by Claude worked on my end:
| if !connectionOptions.urlContexts.isEmpty { | |
| self.scene(scene, openURLContexts: connectionOptions.urlContexts) | |
| } | |
| for userActivity in connectionOptions.userActivities { | |
| self.scene(scene, continue: userActivity) | |
| } | |
| // Plugins haven't loaded yet on a cold start, so notifications posted here are | |
| // missed. Deliver them on the first capacitorViewDidAppear, once plugins are | |
| // registered. | |
| var token: NSObjectProtocol? | |
| token = NotificationCenter.default.addObserver(forName: .capacitorViewDidAppear, object: nil, queue: .main) { _ in | |
| if let token { | |
| NotificationCenter.default.removeObserver(token) | |
| } | |
| if !connectionOptions.urlContexts.isEmpty { | |
| self.scene(scene, openURLContexts: connectionOptions.urlContexts) | |
| } | |
| for userActivity in connectionOptions.userActivities { | |
| self.scene(scene, continue: userActivity) | |
| } | |
| } |
Description
Adds UIScene support to Capacitor, which is required in iOS 27
Change Type
Rationale / Problems Fixed
fixes: #7961
Tests or Reproductions
Screenshots / Media
Platforms Affected
Notes / Comments