Skip to content

IOSurface macOS xcode26.0 b1

Alex Soto edited this page Jun 9, 2025 · 2 revisions

#IOSurface.framework

diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h
--- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h	2025-04-19 00:41:51
+++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h	2025-05-23 05:14:43
@@ -32,6 +32,16 @@
 #define IOSFC_SWIFT_NAME(name)
 #endif
 
+#if defined(__SWIFT_ATTR_SUPPORTS_SENDABLE_DECLS) && __SWIFT_ATTR_SUPPORTS_SENDABLE_DECLS
+    // The typedef or struct should be imported as 'Sendable' in Swift
+    #define IOSFC_SWIFT_SENDABLE __attribute__((swift_attr("@Sendable")))
+    // The typedef or struct should *not* be imported as 'Sendable' in Swift even if it normally would be
+    #define IOSFC_SWIFT_NONSENDABLE __attribute__((swift_attr("@_nonSendable")))
+#else
+    #define IOSFC_SWIFT_SENDABLE
+    #define IOSFC_SWIFT_NONSENDABLE
+#endif // __SWIFT_ATTR_SUPPORTS_SENDABLE_DECLS
+
 #include <mach/kern_return.h>
 #include <mach/mach_types.h>
 #include <CoreFoundation/CoreFoundation.h>
diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h
--- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h	2025-04-19 04:13:59
+++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h	2025-05-23 04:54:34
@@ -12,6 +12,7 @@
 #if defined(__OBJC__)
 
 #import <IOSurface/IOSurfaceTypes.h>
+#import <IOSurface/IOSurfaceRef.h>
 #import <Foundation/Foundation.h>
 
 NS_ASSUME_NONNULL_BEGIN
@@ -107,6 +108,7 @@
 
 // Note: IOSurface objects are "toll free bridged" to IOSurfaceRef objects
 API_AVAILABLE(macos(10.12), ios(11.0), watchos(4.0), tvos(11.0))
+NS_SWIFT_SENDABLE
 @interface IOSurface : NSObject <NSSecureCoding>
 {
 @package
@@ -114,7 +116,7 @@
 }
 
 /* Create a new IOSurface */
-- (nullable instancetype)initWithProperties:(NSDictionary <IOSurfacePropertyKey, id> *)properties;
+- (nullable instancetype)initWithProperties:(NSDictionary <IOSurfacePropertyKey, id NS_SWIFT_SENDABLE> *)properties;
 
 /* "Lock" or "Unlock" a IOSurface for reading or writing.
 
@@ -174,11 +176,11 @@
 /* These calls let you attach property list types to a IOSurface buffer.  These calls are 
    expensive (they essentially must serialize the data into the kernel) and thus should be avoided whenever
    possible.   Note:  These functions can not be used to change the underlying surface properties. */
-- (void)setAttachment:(id)anObject forKey:(NSString *)key;
-- (nullable id)attachmentForKey:(NSString *)key;
+- (void)setAttachment:(id NS_SWIFT_SENDABLE)anObject forKey:(NSString *)key;
+- (nullable id NS_SWIFT_SENDABLE)attachmentForKey:(NSString *)key;
 - (void)removeAttachmentForKey:(NSString *)key;
-- (void)setAllAttachments:(NSDictionary<NSString *, id> *)dict;
-- (nullable NSDictionary<NSString *, id> *)allAttachments;
+- (void)setAllAttachments:(NSDictionary<NSString *, id NS_SWIFT_SENDABLE> *)dict;
+- (nullable NSDictionary<NSString *, id NS_SWIFT_SENDABLE> *)allAttachments;
 - (void)removeAllAttachments;
 
 /* There are cases where it is useful to know whether or not an IOSurface buffer is considered to be "in use"
@@ -220,6 +222,16 @@
 // This key was misnamed.
 extern IOSurfacePropertyKey IOSurfacePropertyAllocSizeKey
     API_DEPRECATED_WITH_REPLACEMENT("IOSurfacePropertyKeyAllocSize",macos(10.12,10.14),ios(11.0,12.0),watchos(4.0,5.0),tvos(11.0,12.0));
+
+static inline __attribute__((always_inline)) IOSurface *_IOSurfaceRefToObj(IOSurfaceRef ref) NS_SWIFT_NAME(IOSurface.init(_:))
+{
+    return (__bridge IOSurface *)ref;
+}
+
+static inline __attribute__((always_inline)) IOSurfaceRef _IOSurfaceObjToRef(IOSurface *obj) NS_SWIFT_NAME(IOSurfaceRef.init(_:))
+{
+    return (__bridge IOSurfaceRef)obj;
+}
 
 NS_ASSUME_NONNULL_END
 
diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceRef.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceRef.h
--- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceRef.h	2025-04-19 03:19:18
+++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceRef.h	2025-05-23 06:06:20
@@ -126,7 +126,7 @@
     kIOSurfaceComponentNameLuma         = 5,
     kIOSurfaceComponentNameChromaRed    = 6,
     kIOSurfaceComponentNameChromaBlue   = 7,
-};
+} IOSFC_SWIFT_SENDABLE;
 
 /* kIOSurfacePlaneComponentNames   - CFArray[CFNumber] for IOSurfaceComponentName of each component in this plane. 
     For example 'BGRA' would be {4, 3, 2, 1} */
@@ -138,7 +138,7 @@
     kIOSurfaceComponentTypeSignedInteger    = 2,
     kIOSurfaceComponentTypeFloat            = 3,
     kIOSurfaceComponentTypeSignedNormalized = 4,
-};
+} IOSFC_SWIFT_SENDABLE;
 
 /* kIOSurfacePlaneComponentTypes   - CFArray[CFNumber] for IOSurfaceComponentType of each component in this plane. */
 extern const CFStringRef kIOSurfacePlaneComponentTypes                      API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0));
@@ -148,7 +148,7 @@
     kIOSurfaceComponentRangeFullRange   = 1,
     kIOSurfaceComponentRangeVideoRange  = 2,
     kIOSurfaceComponentRangeWideRange   = 3,
-};
+} IOSFC_SWIFT_SENDABLE;
 
 /* kIOSurfacePlaneComponentRanges   - CFArray[CFNumber] for IOSurfaceComponentRange of each component in this plane. */
 extern const CFStringRef kIOSurfacePlaneComponentRanges                     API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0));
@@ -159,7 +159,7 @@
     kIOSurfaceSubsampling422        = 2, // Chroma downsampled by 2x1
     kIOSurfaceSubsampling420        = 3, // Chroma downsampled by 2x2
     kIOSurfaceSubsampling411        = 4, // Chroma downsampled by 4x1
-};
+} IOSFC_SWIFT_SENDABLE;
 
 /* kIOSurfaceSubsampling   - CFNumber(IOSurfaceSubsampling) describing the chroma subsampling. */
 extern const CFStringRef kIOSurfaceSubsampling                              API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0));
@@ -455,12 +455,12 @@
     kIOSurfaceMemoryLedgerTagMedia       = 0x00000003,
     kIOSurfaceMemoryLedgerTagGraphics    = 0x00000004,
     kIOSurfaceMemoryLedgerTagNeural      = 0x00000005,
-};
+} IOSFC_SWIFT_SENDABLE;
 
 // Memory ledger flags.
 typedef CF_OPTIONS(uint32_t, IOSurfaceMemoryLedgerFlags) {
     kIOSurfaceMemoryLedgerFlagNoFootprint = (1 << 0),
-};
+} IOSFC_SWIFT_SENDABLE;
 
 
 kern_return_t IOSurfaceSetOwnershipIdentity(IOSurfaceRef buffer, task_id_token_t task_id_token, int newLedgerTag, uint32_t newLedgerOptions) API_AVAILABLE(ios(17.4), watchos(10.4), tvos(17.4), macos(14.4));
diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceTypes.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceTypes.h
--- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceTypes.h	2025-04-19 00:41:51
+++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceTypes.h	2025-05-23 05:14:43
@@ -24,7 +24,7 @@
     // when you lock the buffer, you may include this flag.   If locking the buffer requires a readback, the lock will
     // fail with an error return of kIOReturnCannotLock.
     kIOSurfaceLockAvoidSync =   0x00000002,
-};
+} IOSFC_SWIFT_SENDABLE;
 
 typedef CF_OPTIONS(uint32_t, IOSurfacePurgeabilityState)
 {
@@ -32,7 +32,7 @@
     kIOSurfacePurgeableVolatile    = 1,   // Mark the IOSurface as volatile (contents may be thrown away)
     kIOSurfacePurgeableEmpty       = 2,   // Throw away the contents of the IOSurface immediately
     kIOSurfacePurgeableKeepCurrent = 3,   // Keep the current setting (useful for returning current status info)
-};
+} IOSFC_SWIFT_SENDABLE;
 
 /*
 ** Note: Write-combined memory is optimized for resources that the CPU writes into, but never reads. 

Clone this wiki locally