Skip to content

Fix build on Xcode 16.3 / SDK < 26#359

Merged
davidkoski merged 2 commits into
ml-explore:mainfrom
pcuenca:sendable-cicontext
Jun 21, 2026
Merged

Fix build on Xcode 16.3 / SDK < 26#359
davidkoski merged 2 commits into
ml-explore:mainfrom
pcuenca:sendable-cicontext

Conversation

@pcuenca

@pcuenca pcuenca commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Building MLXVLM on Xcode 16.3 (SDK < 26) fails under Swift strict concurrency because CIContext is not Sendable. The annotation was added to the macOS 26 SDK. We found this out when bumping mlx-swift-lm to the latest 3.x version in AnyLanguageModel.

Proposed changes

Declare the CIContext var as nonisolated(unsafe). CIContext rendering ops are actually thread-safe. macOS SDK v6 added an @unchecked Sendable annotation that is not present in previous SDKs.

We prepared a test repo that uses GitHub CI to show how builds work with this PR and the official repo, for both Xcode 16.3 and Xcode 26.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works (in a separate repo)
  • I have updated the necessary documentation (if needed)

pcuenca added 2 commits June 20, 2026 16:29
Otherwise, the code doesn't compile under Swift strict concurrency.
@davidkoski

Copy link
Copy Markdown
Collaborator

See also #268 -- I thought this was fixed, but I guess not!

@davidkoski davidkoski left a comment

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.

Thank you for the fix, just waiting on CI.

@davidkoski davidkoski merged commit 944828f into ml-explore:main Jun 21, 2026
2 checks passed
@pcuenca pcuenca deleted the sendable-cicontext branch June 21, 2026 16:52
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