Skip to content

Fix native macOS build by excluding SwiftUI WebAuthenticationSession#61

Merged
mattmassicotte merged 2 commits into
ChimeHQ:mainfrom
radmakr:macOS
Jul 7, 2026
Merged

Fix native macOS build by excluding SwiftUI WebAuthenticationSession#61
mattmassicotte merged 2 commits into
ChimeHQ:mainfrom
radmakr:macOS

Conversation

@radmakr

@radmakr radmakr commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

WebAuthenticationSession+Utility.swift doesn't compile when building for
native macOS, breaking swift build on a Mac and any SwiftPM consumer
that resolves OAuthenticator for the macOS host.

It builds no problem in Xcode but swift build fails.

@mattmassicotte

Copy link
Copy Markdown
Contributor

Hey, thanks for reporting this. Do you understand why this is the case? I'm trying to figure it out and I do not understand what exactly is going wrong here.

@mattmassicotte

Copy link
Copy Markdown
Contributor

I've done some research here, and the problem turns out to be non-trivial. But this does need to be available to macOS targets and this is (apparently) how it is done:

#if canImport(_AuthenticationServices_SwiftUI)
import AuthenticationServices
import SwiftUI
import _AuthenticationServices_SwiftUI

// ...

Something about how the AuthenticationServices framework is integrated with SwiftUI is weird and/or exposing a bug.

@mattmassicotte

Copy link
Copy Markdown
Contributor

also, what version of Xcode (swift toolchain) did you notice this problem with?

@radmakr

radmakr commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Do you understand why this is the case?

I don't understand the compiler or build system enough to understand why.

what version of Xcode (swift toolchain)

Xcode Version 26.5 (17F42) but it builds fine in Xcode. It fails to build in the terminal using swift build
I am using swiftly and am currently set to Swift 6.3.0

Since I don't currently need macOS support I am happy to just use my fork's branch. Feel free to close out this PR if you think it is the wrong approach.

This bug really broke my brain. I think it is the first time I had code that could compile with Xcode but not swift build 🤣

@mattmassicotte

Copy link
Copy Markdown
Contributor

I pushed up what I think is a more robust workaround, but I'm 75% sure this should should just have been working as it was before. Something's up but my patience for figuring it out has expired...

@mattmassicotte mattmassicotte merged commit 2af1640 into ChimeHQ:main Jul 7, 2026
10 of 18 checks passed
@radmakr

radmakr commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @mattmassicotte
The changes you made resolved the issue as far as I can tell.

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