Skip to content

Replace deprecated UIScreen.mainScreen in FLEXMacros.h#739

Open
matrush wants to merge 3 commits into
FLEXTool:masterfrom
matrush:master
Open

Replace deprecated UIScreen.mainScreen in FLEXMacros.h#739
matrush wants to merge 3 commits into
FLEXTool:masterfrom
matrush:master

Conversation

@matrush
Copy link
Copy Markdown
Collaborator

@matrush matrush commented Apr 27, 2026

Adds a FLEXScreen() helper that resolves a UIScreen instance through the application's connected scene context, preferring the foreground-active window scene. UIScreen.mainScreen is deprecated in iOS 26.

Screenshot 2026-04-27 at 3 23 58 PM

claude and others added 2 commits April 27, 2026 22:15
Adds a FLEXScreen() helper that resolves a UIScreen instance through the
application's connected scene context, preferring the foreground-active
window scene. UIScreen.mainScreen is deprecated in iOS 26.
…rM9M

Replace deprecated UIScreen.mainScreen in FLEXMacros.h
Copy link
Copy Markdown
Member

@ryanolsonk ryanolsonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit to add braces, otherwise lgtm. Thanks for doing this!

Comment thread Classes/Utility/FLEXMacros.h Outdated
Comment thread Classes/Utility/FLEXMacros.h Outdated
@matrush matrush requested a review from ryanolsonk May 18, 2026 17:35
Copy link
Copy Markdown
Collaborator

@NSExceptional NSExceptional left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

/// since +[UIScreen mainScreen] is deprecated in iOS 26.
NS_INLINE UIScreen *FLEXScreen(void) {
UIScreen *fallback = nil;
for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait a second, connectedScenes is only available in iOS 13+. FLEX supports iOS 9. This will crash on anything below iOS 13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants