WIP: objective-C fetching

This commit is contained in:
John Rommel Estropia
2016-03-27 23:02:24 +09:00
parent 789028bc58
commit b8ea7ecf01
26 changed files with 1939 additions and 198 deletions

View File

@@ -92,4 +92,19 @@ internal func bridge(@noescape closure: () throws -> Void) throws {
}
}
internal func bridge<T>(error: NSErrorPointer, @noescape _ closure: () throws -> T) -> T? {
do {
let result = try closure()
error.memory = nil
return result
}
catch let swiftError {
error.memory = swiftError.objc
return nil
}
}