1212
1313import CoreFoundation
1414
15- // Support protocols for casting
16- public protocol _ObjectBridgeable {
17- func _bridgeToAnyObject( ) -> AnyObject
18- }
19-
2015public protocol _StructBridgeable {
2116 func _bridgeToAny( ) -> Any
2217}
2318
24- /// - Note: This is a similar interface to the _ObjectiveCBridgeable protocol
25- public protocol _ObjectTypeBridgeable : _ObjectBridgeable {
26- associatedtype _ObjectType : AnyObject
27-
28- func _bridgeToObjectiveC( ) -> _ObjectType
29-
30- static func _forceBridgeFromObjectiveC( _ source: _ObjectType , result: inout Self ? )
31-
32- @discardableResult
33- static func _conditionallyBridgeFromObjectiveC( _ source: _ObjectType , result: inout Self ? ) -> Bool
34-
35- static func _unconditionallyBridgeFromObjectiveC( _ source: _ObjectType ? ) -> Self
36- }
37-
3819/// - Note: This does not exist currently on Darwin but it is the inverse correlation to the bridge types such that a
3920/// reference type can be converted via a callout to a conversion method.
4021public protocol _StructTypeBridgeable : _StructBridgeable {
@@ -44,7 +25,7 @@ public protocol _StructTypeBridgeable : _StructBridgeable {
4425}
4526
4627// Default adoption of the type specific variants to the Any variant
47- extension _ObjectTypeBridgeable {
28+ extension _ObjectiveCBridgeable {
4829 public func _bridgeToAnyObject( ) -> AnyObject {
4930 return _bridgeToObjectiveC ( )
5031 }
@@ -74,8 +55,8 @@ internal protocol _NSBridgeable {
7455
7556
7657/// - Note: This is an internal boxing value for containing abstract structures
77- internal final class _SwiftValue : NSObject , NSCopying {
78- internal private( set) var value : Any
58+ internal final class _SwiftValue : NSObject , NSCopying , _NSSwiftValue {
59+ public private( set) var value : Any
7960
8061 static func fetch( _ object: AnyObject ? ) -> Any ? {
8162 if let obj = object {
@@ -108,10 +89,8 @@ internal final class _SwiftValue : NSObject, NSCopying {
10889 static func store( _ value: Any ) -> NSObject {
10990 if let val = value as? NSObject {
11091 return val
111- } else if let val = value as? _ObjectBridgeable {
112- return val. _bridgeToAnyObject ( ) as! NSObject
11392 } else {
114- return _SwiftValue ( value)
93+ return ( value as AnyObject ) as! NSObject
11594 }
11695 }
11796
@@ -144,4 +123,6 @@ internal final class _SwiftValue : NSObject, NSCopying {
144123 public func copy( with zone: NSZone ? ) -> Any {
145124 return _SwiftValue ( value)
146125 }
126+
127+ public static let null : AnyObject = NSNull ( )
147128}
0 commit comments