Skip to content

Instantly share code, notes, and snippets.

@fastred
Last active February 6, 2022 15:35
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fastred/d92ca6145cc2b0cbf6f0 to your computer and use it in GitHub Desktop.
Save fastred/d92ca6145cc2b0cbf6f0 to your computer and use it in GitHub Desktop.
NS_SWIFT_UNAVAILABLE

Results of searching for NS_SWIFT_UNAVAILABLE macro in iOS 9 and OS X 10.11 headers reveal some new Swift-specific APIs.

Highlights

GameplayKit.framework/Headers/GKEntity.h
70: - (nullable GKComponent *)componentForClass:(Class)componentClass
NS_SWIFT_UNAVAILABLE("Exposed in Swift as componentForClass<ComponentType: GKComponent>(componentClass: ComponentType.Type) -> ComponentType?");

GameplayKit.framework/Headers/GKStateMachine.h
46:- (nullable GKState*)stateForClass:(Class)stateClass
NS_SWIFT_UNAVAILABLE("Exposed in Swift as stateForClass<StateType: GKState>(stateClass: StateType.Type) -> StateType?");

SceneKit.framework/Headers/SCNSceneSource.h
304:- (nullable id)entryWithIdentifier:(NSString *)uid withClass:(Class)entryClass
NS_SWIFT_UNAVAILABLE("Exposed in Swift as: func entryWithIdentifier<T>(uid: String, withClass entryClass: T.Type) -> T?");

Foundation.framework/Headers/NSUndoManager.h
114:- (void)registerUndoWithTarget:(id)target handler:(void (^)(id target))undoHandler
NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use generic version instead");

(reformatted to improve readability)

iOS 9

CoreImage.framework/Headers/CIFilter.h
253:- (nullable CIImage *)apply:(CIKernel *)k, ... NS_REQUIRES_NIL_TERMINATION NS_AVAILABLE_MAC(10_4) NS_SWIFT_UNAVAILABLE("");
272:                        keysAndValues:key0, ... NS_REQUIRES_NIL_TERMINATION NS_SWIFT_UNAVAILABLE("");

Foundation.framework/Headers/NSCoder.h
32:- (nullable id)decodeObject NS_SWIFT_UNAVAILABLE("Use 'decodeObject() throws' instead");
33:- (nullable id)decodeObjectAndReturnError:(NSError **)error NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use 'decodeObject() throws' instead");
61:- (nullable id)decodeObjectForKey:(NSString *)key NS_SWIFT_UNAVAILABLE("Use 'decodeObjectForKey(_) throws' instead");
62:- (nullable id)decodeObjectForKey:(NSString *)key error:(NSError **)error NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use 'decodeObjectForKey(_) throws' instead");
78:- (nullable id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0) NS_SWIFT_UNAVAILABLE("Use 'decodeObjectOfClass(_,forKey:) throws' instead");
79:- (nullable id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key error:(NSError **)error NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use 'decodeObjectOfClass(_,forKey:) throws instead");
82:- (nullable id)decodeObjectOfClasses:(nullable NSSet<Class> *)classes forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0)  NS_SWIFT_UNAVAILABLE("Use 'decodeObjectOfClasses(_,forKey:) throws' instead");
83:- (nullable id)decodeObjectOfClasses:(nullable NSSet<Class> *)classes forKey:(NSString *)key error:(NSError **)error NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use 'decodeObjectOfClasses(_,forKey:) throws' instead");

Foundation.framework/Headers/NSInvocation.h
12:NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available")

Foundation.framework/Headers/NSKeyedArchiver.h
97:+ (nullable id)unarchiveObjectWithData:(NSData *)data NS_SWIFT_UNAVAILABLE("Use 'unarchiveObjectWithData() throws' instead");
98:+ (nullable id)unarchiveObjectWithData:(NSData *)data error:(NSError **)error NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use 'unarchiveObjectWithData() throws' instead");
117:- (nullable id)decodeObjectForKey:(NSString *)key NS_SWIFT_UNAVAILABLE("Use 'decodeObjectForKey(_) throws' instead");

Foundation.framework/Headers/NSMethodSignature.h
9:NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available")

Foundation.framework/Headers/NSObjCRuntime.h
305:#define NS_SWIFT_UNAVAILABLE(_msg) CF_SWIFT_UNAVAILABLE(_msg)

Foundation.framework/Headers/NSOperation.h
87:NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available")

Foundation.framework/Headers/NSPort.h
58:- (void)addConnection:(NSConnection *)conn toRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");
59:- (void)removeConnection:(NSConnection *)conn fromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");

Foundation.framework/Headers/NSProxy.h
21:- (nullable NSMethodSignature *)methodSignatureForSelector:(SEL)sel NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available");

Foundation.framework/Headers/NSUndoManager.h
114:- (void)registerUndoWithTarget:(id)target handler:(void (^)(id target))undoHandler NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use generic version instead");

Foundation.framework/Headers/NSZone.h
14:FOUNDATION_EXPORT NSZone *NSDefaultMallocZone(void) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
15:FOUNDATION_EXPORT NSZone *NSCreateZone(NSUInteger startSize, NSUInteger granularity, BOOL canFree) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
16:FOUNDATION_EXPORT void NSRecycleZone(NSZone *zone)NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
18:FOUNDATION_EXPORT void NSSetZoneName(NSZone * __nullable zone, NSString *name)NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
19:FOUNDATION_EXPORT NSString *NSZoneName(NSZone * __nullable zone) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
20:FOUNDATION_EXPORT NSZone * __nullable NSZoneFromPointer(void *ptr) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
22:FOUNDATION_EXPORT void *NSZoneMalloc(NSZone * __nullable zone, NSUInteger size) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
23:FOUNDATION_EXPORT void *NSZoneCalloc(NSZone * __nullable zone, NSUInteger numElems, NSUInteger byteSize) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
24:FOUNDATION_EXPORT void *NSZoneRealloc(NSZone * __nullable zone, void * __nullable ptr, NSUInteger size) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
25:FOUNDATION_EXPORT void NSZoneFree(NSZone * __nullable zone, void *ptr) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
39:FOUNDATION_EXPORT void *__strong NSAllocateCollectable(NSUInteger size, NSUInteger options) NS_SWIFT_UNAVAILABLE("Garbage Collection is not supported");
40:FOUNDATION_EXPORT void *__strong NSReallocateCollectable(void * __nullable ptr, NSUInteger size, NSUInteger options) NS_SWIFT_UNAVAILABLE("Garbage Collection is not supported");
57:NS_INLINE NS_RETURNS_RETAINED id __nullable NSMakeCollectable(CFTypeRef __nullable CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE NS_SWIFT_UNAVAILABLE("Garbage Collection is not supported");

GameplayKit.framework/Headers/GKEntity.h
70: - (nullable GKComponent *)componentForClass:(Class)componentClass NS_SWIFT_UNAVAILABLE("Exposed in Swift as componentForClass<ComponentType: GKComponent>(componentClass: ComponentType.Type) -> ComponentType?");

GameplayKit.framework/Headers/GKStateMachine.h
46:- (nullable GKState*)stateForClass:(Class)stateClass NS_SWIFT_UNAVAILABLE("Exposed in Swift as stateForClass<StateType: GKState>(stateClass: StateType.Type) -> StateType?");

SceneKit.framework/Headers/SCNSceneSource.h
304:- (nullable id)entryWithIdentifier:(NSString *)uid withClass:(Class)entryClass NS_SWIFT_UNAVAILABLE("Exposed in Swift as: func entryWithIdentifier<T>(uid: String, withClass entryClass: T.Type) -> T?");

OS X 10.11

Collaboration.framework/Versions/A/Headers/CBIdentity.h
49:+ (CBIdentity *)identityWithCSIdentity:(CSIdentityRef)csIdentity NS_SWIFT_UNAVAILABLE("CSIdentity is not available in Swift.");
89:@property (readonly) CSIdentityRef CSIdentity NS_SWIFT_UNAVAILABLE("CSIdentity is not available in Swift.");
133:@property (nullable, readonly, nonatomic) NSArray *members NS_DEPRECATED(10_5, 10_11, NA, NA, "Use the memberIdentities property instead.") NS_SWIFT_UNAVAILABLE("Use the memberIdentities property instead. CSIdentity is not available in Swift.");

Collaboration.framework/Versions/A/Headers/CBIdentityAuthority.h
35:+ (CBIdentityAuthority *)identityAuthorityWithCSIdentityAuthority:(CSIdentityAuthorityRef)CSIdentityAuthority NS_SWIFT_UNAVAILABLE("CSIdentityAuthority is not available in Swift.");
38:@property (readonly) CSIdentityAuthorityRef CSIdentityAuthority NS_SWIFT_UNAVAILABLE("CSIdentityAuthority is not available in Swift.");

CoreImage.framework/Versions/A/Headers/CIFilter.h
253:- (nullable CIImage *)apply:(CIKernel *)k, ... NS_REQUIRES_NIL_TERMINATION NS_AVAILABLE_MAC(10_4) NS_SWIFT_UNAVAILABLE("");
272:                        keysAndValues:key0, ... NS_REQUIRES_NIL_TERMINATION NS_SWIFT_UNAVAILABLE("");

Foundation.framework/Versions/C/Headers/NSCalendarDate.h
24:NS_SWIFT_UNAVAILABLE("Use NSCalendar and NSDateComponents and NSDateFormatter instead")

Foundation.framework/Versions/C/Headers/NSCoder.h
32:- (nullable id)decodeObject NS_SWIFT_UNAVAILABLE("Use 'decodeObject() throws' instead");
33:- (nullable id)decodeObjectAndReturnError:(NSError **)error NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use 'decodeObject() throws' instead");
61:- (nullable id)decodeObjectForKey:(NSString *)key NS_SWIFT_UNAVAILABLE("Use 'decodeObjectForKey(_) throws' instead");
62:- (nullable id)decodeObjectForKey:(NSString *)key error:(NSError **)error NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use 'decodeObjectForKey(_) throws' instead");
78:- (nullable id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0) NS_SWIFT_UNAVAILABLE("Use 'decodeObjectOfClass(_,forKey:) throws' instead");
79:- (nullable id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key error:(NSError **)error NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use 'decodeObjectOfClass(_,forKey:) throws instead");
82:- (nullable id)decodeObjectOfClasses:(nullable NSSet<Class> *)classes forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0)  NS_SWIFT_UNAVAILABLE("Use 'decodeObjectOfClasses(_,forKey:) throws' instead");
83:- (nullable id)decodeObjectOfClasses:(nullable NSSet<Class> *)classes forKey:(NSString *)key error:(NSError **)error NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use 'decodeObjectOfClasses(_,forKey:) throws' instead");

Foundation.framework/Versions/C/Headers/NSConnection.h
16:NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
107:FOUNDATION_EXPORT NSString * const NSConnectionReplyMode NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");
109:FOUNDATION_EXPORT NSString * const NSConnectionDidDieNotification NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");
112:NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
133:FOUNDATION_EXPORT NSString * const NSFailedAuthenticationException NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");
135:FOUNDATION_EXPORT NSString * const NSConnectionDidInitializeNotification NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");
137:NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")

Foundation.framework/Versions/C/Headers/NSDistantObject.h
11:NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")

Foundation.framework/Versions/C/Headers/NSGarbageCollector.h
12:NS_SWIFT_UNAVAILABLE("Garbage Collection is not supported")

Foundation.framework/Versions/C/Headers/NSGeometry.h
42:    NSMinXEdge NS_SWIFT_UNAVAILABLE("Use NSRectEdge.MinX instead") = NSRectEdgeMinX,
43:    NSMinYEdge NS_SWIFT_UNAVAILABLE("Use NSRectEdge.MinY instead") = NSRectEdgeMinY,
44:    NSMaxXEdge NS_SWIFT_UNAVAILABLE("Use NSRectEdge.MaxX instead") = NSRectEdgeMaxX,
45:    NSMaxYEdge NS_SWIFT_UNAVAILABLE("Use NSRectEdge.MaxX instead") = NSRectEdgeMaxY,

Foundation.framework/Versions/C/Headers/NSInvocation.h
12:NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available")

Foundation.framework/Versions/C/Headers/NSKeyedArchiver.h
97:+ (nullable id)unarchiveObjectWithData:(NSData *)data NS_SWIFT_UNAVAILABLE("Use 'unarchiveObjectWithData() throws' instead");
98:+ (nullable id)unarchiveObjectWithData:(NSData *)data error:(NSError **)error NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use 'unarchiveObjectWithData() throws' instead");
117:- (nullable id)decodeObjectForKey:(NSString *)key NS_SWIFT_UNAVAILABLE("Use 'decodeObjectForKey(_) throws' instead");

Foundation.framework/Versions/C/Headers/NSMethodSignature.h
9:NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available")

Foundation.framework/Versions/C/Headers/NSObjCRuntime.h
305:#define NS_SWIFT_UNAVAILABLE(_msg) CF_SWIFT_UNAVAILABLE(_msg)

Foundation.framework/Versions/C/Headers/NSOperation.h
87:NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available")

Foundation.framework/Versions/C/Headers/NSPort.h
58:- (void)addConnection:(NSConnection *)conn toRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");
59:- (void)removeConnection:(NSConnection *)conn fromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");

Foundation.framework/Versions/C/Headers/NSPortCoder.h
11:NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
29:@property (readonly) Class classForPortCoder NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");
31:- (nullable id)replacementObjectForPortCoder:(NSPortCoder *)coder NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");

Foundation.framework/Versions/C/Headers/NSPortNameServer.h
11:NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
27:NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
52:NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
73:NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")

Foundation.framework/Versions/C/Headers/NSProxy.h
21:- (nullable NSMethodSignature *)methodSignatureForSelector:(SEL)sel NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available");

Foundation.framework/Versions/C/Headers/NSUndoManager.h
114:- (void)registerUndoWithTarget:(id)target handler:(void (^)(id target))undoHandler NS_AVAILABLE(10_11, 9_0) NS_SWIFT_UNAVAILABLE("Use generic version instead");

Foundation.framework/Versions/C/Headers/NSZone.h
14:FOUNDATION_EXPORT NSZone *NSDefaultMallocZone(void) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
15:FOUNDATION_EXPORT NSZone *NSCreateZone(NSUInteger startSize, NSUInteger granularity, BOOL canFree) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
16:FOUNDATION_EXPORT void NSRecycleZone(NSZone *zone)NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
18:FOUNDATION_EXPORT void NSSetZoneName(NSZone * __nullable zone, NSString *name)NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
19:FOUNDATION_EXPORT NSString *NSZoneName(NSZone * __nullable zone) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
20:FOUNDATION_EXPORT NSZone * __nullable NSZoneFromPointer(void *ptr) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
22:FOUNDATION_EXPORT void *NSZoneMalloc(NSZone * __nullable zone, NSUInteger size) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
23:FOUNDATION_EXPORT void *NSZoneCalloc(NSZone * __nullable zone, NSUInteger numElems, NSUInteger byteSize) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
24:FOUNDATION_EXPORT void *NSZoneRealloc(NSZone * __nullable zone, void * __nullable ptr, NSUInteger size) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
25:FOUNDATION_EXPORT void NSZoneFree(NSZone * __nullable zone, void *ptr) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
39:FOUNDATION_EXPORT void *__strong NSAllocateCollectable(NSUInteger size, NSUInteger options) NS_SWIFT_UNAVAILABLE("Garbage Collection is not supported");
40:FOUNDATION_EXPORT void *__strong NSReallocateCollectable(void * __nullable ptr, NSUInteger size, NSUInteger options) NS_SWIFT_UNAVAILABLE("Garbage Collection is not supported");
57:NS_INLINE NS_RETURNS_RETAINED id __nullable NSMakeCollectable(CFTypeRef __nullable CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE NS_SWIFT_UNAVAILABLE("Garbage Collection is not supported");

GameplayKit.framework/Versions/A/Headers/GKEntity.h
70: - (nullable GKComponent *)componentForClass:(Class)componentClass NS_SWIFT_UNAVAILABLE("Exposed in Swift as componentForClass<ComponentType: GKComponent>(componentClass: ComponentType.Type) -> ComponentType?");

GameplayKit.framework/Versions/A/Headers/GKStateMachine.h
46:- (nullable GKState*)stateForClass:(Class)stateClass NS_SWIFT_UNAVAILABLE("Exposed in Swift as stateForClass<StateType: GKState>(stateClass: StateType.Type) -> StateType?");

SceneKit.framework/Versions/A/Headers/SCNSceneSource.h
304:- (nullable id)entryWithIdentifier:(NSString *)uid withClass:(Class)entryClass NS_SWIFT_UNAVAILABLE("Exposed in Swift as: func entryWithIdentifier<T>(uid: String, withClass entryClass: T.Type) -> T?");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment