Re: [swift-users] Proper Way to make Errors in Swift 3

2017-03-06 Thread Ronak via swift-users
Hi Ole, Yes that’s what I’m resorting to now. I had to change my Swift code to return NSError to all clients, regardless of language. Therefore, I really wonder why CustomNSError even exists. I could have just used NSError from the get go... Ronak > On Mar 5, 2017, at 2:20 PM, Ole Begemann w

Re: [swift-users] Proper Way to make Errors in Swift 3

2017-03-05 Thread Ole Begemann via swift-users
Have you tried explicitly casting the value to NSError when you pass it to Objective-C? I think it should work then. let myError: MyError = ... myObjCFunc(myError as NSError) On 02/03/2017 17:29, Ronak via swift-users wrote: Hi everyone, It looks like I’m still having issues exposing

Re: [swift-users] Proper Way to make Errors in Swift 3

2017-03-02 Thread Ronak via swift-users
Hi everyone, It looks like I’m still having issues exposing a CustomNSError to Objective-C. I am generating errors of this type in Swift and then trying to bridge them in one direction over to Objective-C. From Objective-C, this Error type is being exposed as a _SwiftValue. Do I have to mark th

Re: [swift-users] Proper Way to make Errors in Swift 3

2016-09-29 Thread Ronak via swift-users
Ahh..thanks for the reply Zach. I didn’t actually see your reply until now. I’ll see how I can adjust my code. Thanks for this! > On Sep 29, 2016, at 4:38 PM, Zach Waldowski wrote: > > Error types themselves shouldn’t generally cross into Objective-C, because > you don’t get interop; for tha

Re: [swift-users] Proper Way to make Errors in Swift 3

2016-09-29 Thread Ronak via swift-users
Hi, I’ve actually switched our implementation to: /// The type of an error code. @objc public enum FoundationErrorCode: Int { /// An ARCOperationCondition failed during evaluation case operationConditionFailed = 1 /// An ARCOperation failed during execution case operationExe

Re: [swift-users] Proper Way to make Errors in Swift 3

2016-09-29 Thread Zach Waldowski via swift-users
Error types themselves shouldn’t generally cross into Objective-C, because you don’t get interop; for that, we have Error, which crosses the bridge as NSError. If it’s instructive to think of it this way, both Objective-C and Swift should define errors in their best native way, and use NSError.