Created
April 4, 2016 11:06
-
-
Save mike-ferenduros/11327de14a07a1a595cf662554cc6c62 to your computer and use it in GitHub Desktop.
Int64 bridging!
This file contains 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
extension Int64 : _ObjectiveCBridgeable | |
{ | |
public init(_ number: NSNumber) | |
{ | |
self.init(number.longLongValue) | |
} | |
public func _bridgeToObjectiveC() -> NSNumber | |
{ | |
return NSNumber(longLong: self) | |
} | |
public static func _getObjectiveCType() -> Any.Type | |
{ | |
return NSNumber.self | |
} | |
public static func _isBridgedToObjectiveC() -> Bool | |
{ | |
return true | |
} | |
public static func _forceBridgeFromObjectiveC(source: NSNumber, inout result: Int64?) | |
{ | |
result = source.longLongValue | |
} | |
public static func _conditionallyBridgeFromObjectiveC(source: NSNumber, inout result: Int64?) -> Bool | |
{ | |
result = source.longLongValue | |
return true | |
} | |
} | |
let a = Int64(123) | |
let b: [AnyObject] = [a] //hurrah! | |
let c = [a] as NSArray //yay! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment