-
Notifications
You must be signed in to change notification settings - Fork 218
fix: accessing Availability.h macros in Swift (Xcode 26 support) #4013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@liamnichols This looks a prominent fix any ideas by when can we see this merged and released? CC: @harsh62 |
@harish-suthar Thanks for tagging me. @liamnichols Thanks for you contribution. The change on a high level looks good. I've approved and ran the workflows to check the health of the PR. I will work with my team to get feedback. |
@liamnichols @harish-suthar This needs to be build on the minimum version of Xcode supported by Amplify which is Xcode 15. At the moment its failing with:
|
8e6bd27
to
4192ddd
Compare
Hi @harsh62, thanks for pointing this out.. I don't have access to Xcode 15 locally so I hadn't realised this 🙇 I've made some changes to use a regular If you could re-run CI that would be appreciated 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for merging this @harsh62! Would it be possible if you could share timelines for releasing updates to amplify-swift and amplify-ui-swift-liveness that contain this patch? No worries if it won't be for a while, I just need to know if it is worth me creating some forks and using them in the meantime or not 🙂 |
I am gonna try to release this week, with a couple of other fixes in the pipeline. At most it could slip into next week. |
Issue #
#4003
Description
Starting in Xcode 26, the Availability.h/AvailabilityInternal.h headers that contained the
__IPHONE_OS_VERSION_MIN_REQUIRED
and__MAC_OS_X_VERSION_MIN_REQUIRED
preprocessor macros are no longer implicitly exposed to Swift code via theos_availability
/os_availability_internal
modules which has prevented the Amplify SDK from compiling.I saw that the
xcode-26
branch just commented out the problematic code as a workaround, but I wanted to propose a more suitable fix that involved explicitly exposing the macro values to the AWSCognitoAuthPlugin target via a new AmplifyAvailability system library target.The new target defines a module map that exposes the AmplifyAvailability.h header and within this header, we just redefine the Availability.h preprocessor macros via
getIOSVersionMinRequired()
andgetMACOSXVersionMinRequired()
. These new static symbols are now exposed to the Swift code and can be used instead to provide support both in Xcode 26 and older versions.General Checklist
Given When Then
inline code documentation and are named accordinglytestThing_condition_expectation()
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.