Skip to content

fix(ios): qualify enum cases for newer Swift compilers#1467

Merged
subhankarmaiti merged 2 commits intoauth0:masterfrom
ThnxFredrik:fix/swift-enum-ambiguity
Mar 27, 2026
Merged

fix(ios): qualify enum cases for newer Swift compilers#1467
subhankarmaiti merged 2 commits intoauth0:masterfrom
ThnxFredrik:fix/swift-enum-ambiguity

Conversation

@ThnxFredrik
Copy link
Copy Markdown
Contributor

@ThnxFredrik ThnxFredrik commented Mar 25, 2026

Changes

This change updates ios/NativeBridge.swift to explicitly qualify a small number of enum cases that are ambiguous on newer Swift compilers.

Changed cases:

  • WebAuthError.other in WebAuthError.reactNativeErrorCode()
  • DPoPError.other in DPoPError.reactNativeErrorCode()
  • DPoPError.unknown in DPoPError.reactNativeErrorCode()

Why this is important:

  • On newer Apple toolchains, the unqualified .other and .unknown cases fail to compile with errors such as ambiguous use of 'other' and ambiguous use of 'unknown'.
  • This prevents iOS builds from succeeding for consumers using newer Xcode / Swift versions.
  • The change is intentionally minimal and does not alter runtime behavior. It only makes the enum pattern matching explicit for the compiler.

Public API:

  • No public API changes
  • No endpoint changes
  • No UI changes

References

Public references:

Non-public / local reproduction:

  • Reproduced in a downstream React Native + Expo app using:
    • react-native-auth0@5.4.0
    • Xcode 26.4
    • Apple Swift 6.3

If an issue is opened for this bug, it can be added here as well.

Testing

How reviewers can test:

  1. Check out this branch
  2. Install dependencies
  3. Build the iOS target using a recent Xcode / Swift toolchain
  4. Confirm that NativeBridge.swift no longer fails with ambiguous enum case errors for .other / .unknown

Tested locally:

  • Reproduced the compiler failure in a downstream app using Xcode 26.4 / Swift 6.3
  • Verified that this change fixes the downstream iOS build
  • This is a compiler-compatibility fix rather than a runtime behavior change

Limitations:

  • I validated this through downstream integration rather than this repository’s full test/build matrix

  • No unit tests were added because this is a compiler-compatibility fix in Swift switch matching, not a behavioral change

  • This change adds unit test coverage

  • This change has been tested on the latest version of the platform/language or why not

Reason not checked for unit coverage:

  • This change does not introduce new runtime logic; it resolves a compile-time ambiguity on newer Swift compilers.

Notes:

Checklist

Copy link
Copy Markdown

@bhamiltoncx bhamiltoncx left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! I confirmed this fixed the build break with Xcode 26.4.

@subhankarmaiti
Copy link
Copy Markdown
Contributor

Thanks for opening the PR @ThnxFredrik
Could you please rebase the PR and instead of only changing .other or .unknown. We could consider qualifying all enum cases in these two switch blocks (e.g., WebAuthError.noBundleIdentifier, DPoPError.secureEnclaveOperationFailed, etc.), not just the ambiguous ones.

@ThnxFredrik ThnxFredrik force-pushed the fix/swift-enum-ambiguity branch from aaf73c6 to 537165b Compare March 26, 2026 21:21
@ThnxFredrik
Copy link
Copy Markdown
Contributor Author

Thanks for opening the PR @ThnxFredrik Could you please rebase the PR and instead of only changing .other or .unknown. We could consider qualifying all enum cases in these two switch blocks (e.g., WebAuthError.noBundleIdentifier, DPoPError.secureEnclaveOperationFailed, etc.), not just the ambiguous ones.

Fixed in fix(ios): qualify enum cases for newer Swift compilers

@subhankarmaiti subhankarmaiti enabled auto-merge (squash) March 27, 2026 04:25
@subhankarmaiti subhankarmaiti disabled auto-merge March 27, 2026 04:25
@subhankarmaiti
Copy link
Copy Markdown
Contributor

Hi @ThnxFredrik
Could you please verify your commit, you can refer to the doc: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
Screenshot 2026-03-27 at 10 00 12 AM

@ThnxFredrik ThnxFredrik force-pushed the fix/swift-enum-ambiguity branch from b878bb1 to 485828d Compare March 27, 2026 05:51
@ThnxFredrik
Copy link
Copy Markdown
Contributor Author

Hi @ThnxFredrik Could you please verify your commit, you can refer to the doc: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits Screenshot 2026-03-27 at 10 00 12 AM

There we go, took a while 😅 but now both commits should be verified 👍🏼

@subhankarmaiti subhankarmaiti merged commit f625448 into auth0:master Mar 27, 2026
3 of 5 checks passed
@ThnxFredrik ThnxFredrik deleted the fix/swift-enum-ambiguity branch March 27, 2026 05:55
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.

Compile Issues with XCode 26.4: "Ambiguous use of"

3 participants