fix: adopt scene-aware UIWindow lookup for UIScene lifecycle - #18
Merged
Conversation
OS-ruimoreiramendes
marked this pull request as ready for review
July 29, 2026 10:10
OS-ruimoreiramendes
requested review from
ItsChaceD,
OS-pedrogustavobilro,
alexgerardojacinto,
andredestro,
markemer and
theproducer
July 29, 2026 10:10
OS-pedrogustavobilro
approved these changes
Jul 30, 2026
capacitor-bot
pushed a commit
that referenced
this pull request
Jul 30, 2026
## [1.0.5](1.0.4...1.0.5) (2026-07-30) ### Bug Fixes * adopt scene-aware UIWindow lookup for UIScene lifecycle ([#18](#18)) ([05128d6](05128d6))
This was referenced Jul 30, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adopts a scene-aware pattern for looking up the current interface orientation, replacing the deprecated
UIApplication.shared.windows.firstaccessor with a newUIApplication.firstKeyWindowForConnectedSceneshelper that iteratesconnectedScenesand picks the key window from the activeUIWindowScene.ref: https://outsystemsrd.atlassian.net/browse/RMET-5367
Change Type
Rationale / Problems Fixed
UIApplication.shared.windowshas been deprecated since iOS 15.0. In scene-based apps it can return unreliable results,nilor windows from a different scene, which breaks orientation detection during image editing.Starting with iOS 27, the UIScene lifecycle becomes mandatory (see Apple TN3187). Apps built with the iOS 27 SDK need
UIApplicationSceneManifestat the shell level. While that doesn't stop this library from compiling,UIApplication.shared.windowsbecomes even less reliable in scene-based apps, it may returnnilor windows from a different scene, causing silent orientation-detection bugs (editor layout not matching the actual device orientation, especially in iPad Split View / Stage Manager / foldables). Migrating toconnectedScenesmakes the lookup consistent across single- and multi-scene apps.The same scene-aware pattern is already in use in OSBarcodeLib-iOS, which has been shipping in Capacitor 8 apps in production.
Tests or Reproductions
Smoke-tested end-to-end via the
capacitor-cameraexample-app and Camera Sample App (ODC) on:- iPhone 17 (iOS 26.5 simulator) — portrait + landscape + rotation during edit
- **iPhone 15 Pro (iOS 27) — portrait + landscape + rotation during edit
- iPad Pro 13-inch (iOS 26.4 simulator) — portrait + landscape
- iPad Pro 13-inch in Split View (multi-scene) — portrait + landscape + rotation
All orientation transitions adapt the editor layout correctly (bar/buttons repositioning)
In order to test this PR use the Camera Sample App latest build in ODC and/or Camera Example App (capacitor) on branch
Platforms Affected