From 11efd08f6057646571d379d14a936543eb062914 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Wed, 4 Nov 2026 16:50:59 +0100 Subject: [PATCH 1/4] fix(SPI): import the CoreFoundation string tokenizer header explicitly 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 aedeae7e579cd71525160f04f209e01ae4bce5d0) --- Sources/OpenSwiftUI_SPI/Overlay/Foundation/Localization.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/OpenSwiftUI_SPI/Overlay/Foundation/Localization.m b/Sources/OpenSwiftUI_SPI/Overlay/Foundation/Localization.m index 63792656f..58ecd21b1 100644 --- a/Sources/OpenSwiftUI_SPI/Overlay/Foundation/Localization.m +++ b/Sources/OpenSwiftUI_SPI/Overlay/Foundation/Localization.m @@ -10,6 +10,7 @@ #if OPENSWIFTUI_TARGET_OS_DARWIN #import +#import #import @interface NSBundle (OpenSwiftUILocalizationPrivate) From 1c760d2128fe600f671d19b1849421ab24644103 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Wed, 4 Nov 2026 16:50:59 +0100 Subject: [PATCH 2/4] fix(GraphicsImage): import IOSurface and use the current Swift spelling 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 ff285c40f1d6c12e3f554dd7031c28127eac93e6) --- Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift b/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift index 2a534e433..756b30521 100644 --- a/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift +++ b/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift @@ -8,6 +8,9 @@ package import OpenCoreGraphicsShims package import OpenRenderBoxShims +#if canImport(IOSurface) +package import IOSurface +#endif #if canImport(CoreGraphics) import CoreGraphics_Private #endif @@ -21,7 +24,7 @@ package import CoreUI package struct GraphicsImage: Equatable, Sendable { package enum Contents: Equatable, @unchecked Sendable { case cgImage(CGImage) - case ioSurface(IOSurfaceRef) + case ioSurface(IOSurface) indirect case vectorGlyph(ResolvedVectorGlyph) indirect case vectorLayer(VectorImageLayer) indirect case color(Color.Resolved) From b067b39e7c79e7a45d33e6d7ab6c1845f6406583 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Wed, 4 Nov 2026 16:50:59 +0100 Subject: [PATCH 3/4] fix(SPI): type the dynamic UIKit color initializer 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 e493940e3e42fde13a66fe08c87a20448608eeaf) --- .../Overlay/CoreGraphics/OpenSwiftUICoreColor.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sources/OpenSwiftUI_SPI/Overlay/CoreGraphics/OpenSwiftUICoreColor.m b/Sources/OpenSwiftUI_SPI/Overlay/CoreGraphics/OpenSwiftUICoreColor.m index 450a18e0a..b68e4df07 100644 --- a/Sources/OpenSwiftUI_SPI/Overlay/CoreGraphics/OpenSwiftUICoreColor.m +++ b/Sources/OpenSwiftUI_SPI/Overlay/CoreGraphics/OpenSwiftUICoreColor.m @@ -20,6 +20,13 @@ #if OPENSWIFTUI_TARGET_OS_OSX id NSColorSpaceForCGColorSpace(CGColorSpaceRef cgColorSpace); Class NSColorSpaceClass(void); + +// This path can select UIColor dynamically on macOS. AppKit headers do not +// declare UIColor's initializer, so describe it without adding it to NSColor. +@protocol OpenSwiftUIUIKitRGBAColor +- (instancetype)initWithRed:(CGFloat)red green:(CGFloat)green + blue:(CGFloat)blue alpha:(CGFloat)alpha; +@end #endif BOOL OpenSwiftUICoreColorPlatformColorGetComponents(OpenSwiftUICoreSystem system, id color, CGFloat *red, CGFloat *green, CGFloat *blue, CGFloat *alpha) { @@ -59,7 +66,8 @@ id OpenSwiftUICorePlatformColorForRGBA(OpenSwiftUICoreSystem system, CGFloat red id colorSpace = NSColorSpaceForCGColorSpace(CGColorSpaceCreateWithName(kCGColorSpaceExtendedSRGB)); return [colorClass colorWithColorSpace:colorSpace components:(CGFloat[]){red, green, blue, alpha} count:4]; } else { - return [[colorClass alloc] initWithRed:red green:green blue:blue alpha:alpha]; + return [(id)[colorClass alloc] + initWithRed:red green:green blue:blue alpha:alpha]; } #else return [[colorClass alloc] initWithRed:red green:green blue:blue alpha:alpha]; From 9c3b75b44d2383fce7529f01f81d8d841ae1512c Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Wed, 4 Nov 2026 16:56:47 +0100 Subject: [PATCH 4/4] fix(GraphicsImage): keep IOSurfaceRef where the IOSurface module is absent 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. --- Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift b/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift index 756b30521..d44f769bb 100644 --- a/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift +++ b/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift @@ -24,7 +24,11 @@ package import CoreUI package struct GraphicsImage: Equatable, Sendable { package enum Contents: Equatable, @unchecked Sendable { case cgImage(CGImage) + #if canImport(IOSurface) case ioSurface(IOSurface) + #else + case ioSurface(IOSurfaceRef) + #endif indirect case vectorGlyph(ResolvedVectorGlyph) indirect case vectorLayer(VectorImageLayer) indirect case color(Color.Resolved)