mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-20 00:24:01 +01:00
WIP: objective-C fetching
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user