Repository navigation
fix(SPI): three small SDK-compatibility fixes (IOSurface import, tokenizer header, UIColor init) - #1246
Draft
cristim wants to merge 4 commits into
Draft
fix(SPI): three small SDK-compatibility fixes (IOSurface import, tokenizer header, UIColor init)#1246cristim wants to merge 4 commits into
cristim wants to merge 4 commits into
Conversation
Localization.m uses CFStringTokenizer but only imports the CoreFoundation umbrella. Import CFStringTokenizer.h directly so the file does not depend on what the umbrella happens to pull in on a given SDK. (cherry picked from commit aedeae7)
GraphicsImage.Contents.ioSurface names IOSurfaceRef without importing IOSurface, so the type does not resolve on SDKs where it is not re-exported. Import the module and spell the type IOSurface; with the module imported and the old spelling kept, Swift reports that IOSurfaceRef has been renamed to IOSurface. The old spelling is a typealias of the same type, so the symbol mangling is unchanged. (cherry picked from commit ff285c4)
The macOS path can select UIColor dynamically, but AppKit headers do not declare UIColor's initWithRed:green:blue:alpha:. Describe it with a local protocol and cast to it, instead of messaging an untyped id. (cherry picked from commit e493940)
…bsent The previous commit spells the case type IOSurface unconditionally, but on platforms without the IOSurface module (Linux) only OpenCoreGraphics' IOSurfaceRef exists. Select the spelling with the same canImport guard as the import.
Author
|
Cold review of 11efd08/1c760d21/b067b39e: tokenizer import and UIColor protocol cast clean; the IOSurface spelling would have broken the Linux build (only IOSurfaceRef exists there). Fixed in 9c3b75b by keeping IOSurfaceRef under the non-canImport branch. PR title and body updated to the conventional format. Still not compiled: no Swift or ObjC compiler on the machine used; CI is the first real check. |
This was referenced Nov 4, 2026
Kyle-Ye
requested changes
Nov 7, 2026
| package enum Contents: Equatable, @unchecked Sendable { | ||
| case cgImage(CGImage) | ||
| #if canImport(IOSurface) | ||
| case ioSurface(IOSurface) |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RFC, draft, unbuilt. Three small SDK-compatibility fixes found while building OpenSwiftUI against a non-Apple Darwin-compatible SDK. Each is independent and touches one file:
Localization.m: importCFStringTokenizer.hexplicitly instead of relying on the CoreFoundation umbrella.GraphicsImage.swift:import IOSurfaceand spell the case typeIOSurfacewhere the module exists; elsewhere keepIOSurfaceRef(follow-up commit, found in review). The old spelling is a typealias of the same type, so mangling is unchanged on Darwin.OpenSwiftUICoreColor.m: describeUIColor'sinitWithRed:green:blue:alpha:with a local protocol and cast to it, instead of messaging an untypedid.Verification
Run: each commit cherry-picks cleanly onto current
main; a cold review read all call sites of the changed types. Not run: no Swift or Objective-C compiler was available, so nothing was compiled and the Linux and macOS CI jobs are the first real check.CONTRIBUTING.md asks for an issue or discussion first for large work; this PR is deliberately small. Larger Darling-specific changes from my fork are held back.