fix bridging producing base abstract class instead of subclass concrete class

This commit is contained in:
John Rommel Estropia
2016-09-11 14:30:25 +09:00
parent df835114cb
commit 243c4044ab
6 changed files with 92 additions and 33 deletions

View File

@@ -118,12 +118,18 @@ internal func bridge<T: CoreStoreSwiftType>(error: NSErrorPointer, @noescape _ c
do {
let result = try closure()
error.memory = nil
if error != nil {
error.memory = nil
}
return result.bridgeToObjectiveC
}
catch let swiftError {
error.memory = swiftError.bridgeToObjectiveC
if error != nil {
error.memory = swiftError.bridgeToObjectiveC
}
return nil
}
}
@@ -133,12 +139,18 @@ internal func bridge(error: NSErrorPointer, @noescape _ closure: () throws -> Vo
do {
try closure()
error.memory = nil
if error != nil {
error.memory = nil
}
return true
}
catch let swiftError {
error.memory = swiftError.bridgeToObjectiveC
if error != nil {
error.memory = swiftError.bridgeToObjectiveC
}
return false
}
}
@@ -148,12 +160,18 @@ internal func bridge<T>(error: NSErrorPointer, @noescape _ closure: () throws ->
do {
let result = try closure()
error.memory = nil
if error != nil {
error.memory = nil
}
return result
}
catch let swiftError {
error.memory = swiftError.bridgeToObjectiveC
if error != nil {
error.memory = swiftError.bridgeToObjectiveC
}
return nil
}
}
@@ -163,12 +181,18 @@ internal func bridge<T: CoreStoreSwiftType>(error: NSErrorPointer, @noescape _ c
do {
let result = try closure()
error.memory = nil
if error != nil {
error.memory = nil
}
return result.map { $0.bridgeToObjectiveC }
}
catch let swiftError {
error.memory = swiftError.bridgeToObjectiveC
if error != nil {
error.memory = swiftError.bridgeToObjectiveC
}
return nil
}
}