Skip to content

Conversation

@Pretz
Copy link

@Pretz Pretz commented Oct 31, 2025

Xcode 26 has started treating warnings in SPM headers as project-level warnings for users of the package. This causes issues for any project that has warnings as errors enabled and imports FLEX.

See similar discussions at
facebook/facebook-ios-sdk#2602 and RevenueCat/purchases-ios#5290

Fix two issues with FLEX that hit this change:

  • Wrap uses of UIScreen.mainScreen in FLEXMacros.h in clang diagnostic ignored "-Wdeprecated-declarations"
  • Add FLEXFileBrowserController.h to FLEX.h and mark as public in the Xcode project config.  Since FLEXFileBrowserController.h is part of the SwiftPM public headers after being added in Make FLEXFileBrowserController public #702 , it must be declared in the umbrella header to avoid FLEX/Classes/Headers/FLEX.h:26:1 umbrella header for module 'FLEX' does not include header 'FLEXFileBrowserController.h'. Once added to the umbrella header, the Xcode project would not build because the header was not marked public in the project file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we instead update this code to conditionally use UIScreen.screen when available? i.e.

NS_INLINE CGFloat FLEXGetScale() {
    if (@available(iOS 13.0, *) {
        return UIScreen.screen.scale;
    } else {
        return UIScreen.mainScreen.scale;
    }
}

// And use FLEXGetScale() instead in FLEXFloor()

Copy link
Author

Choose a reason for hiding this comment

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

Maddeningly, wrapping in an @available check isn't sufficient to silence the deprecation warnings triggered via the SwiftPM import.

Something like this would work though, which at least keeps the diagnostic override contained to one spot:

NS_INLINE CGFloat FLEXGetScale(void) {
  if (@available(iOS 13.0, *)) {
    return UITraitCollection.currentTraitCollection.displayScale;
  } else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
    return UIScreen.mainScreen.scale;
#pragma clang diagnostic pop
  }
}

I'm not sure if using UITraitCollection.currentTraitCollection will work consistently for all uses of FLEXFloor etc. An alternative would be to pull it from the UIApplication singleton's connectedScenes, but that will be more cumbersome.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maddeningly, wrapping in an @available check isn't sufficient to silence the deprecation warnings triggered via the SwiftPM import.

I don't want this to be true, but it would not surprise me. Lemme play around with this in an example project and see if I can reproduce it

Copy link
Collaborator

Choose a reason for hiding this comment

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

These files don't control header visibility in SPM, as far as I know. Did this somehow silence the warnings for you? Wouldn't Package.swift need to change instead? (And the associated script that generates code for the Package.swift, generate-spm-headers.sh

Copy link
Author

Choose a reason for hiding this comment

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

The key change needed to support SwiftPM was ensuring this header was imported by FLEX.h, since it's a public header. Adding to FLEX.h fixes the error FLEX.h:26:1: umbrella header for module 'FLEX' does not include header 'FLEXFileBrowserController.h'

However, once I added the header to FLEX.h, the normal Xcode project build (not SwiftPM) failed, because FLEXFileBrowserController.h wasn't marked public in the project, despite being imported in FLEX.h:

Include of non-modular header inside framework module 'FLEX': '/Users/apretzlav/FLEX/Classes/GlobalStateExplorers/FileBrowser/FLEXFileBrowserController.h'

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.

2 participants