[swift-evolution] [Proposal idea] Improved interop for ErrorType->NSError
cocoadev at charlessoft.com
Sun Dec 20 16:03:03 CST 2015
> On Dec 20, 2015, at 3:14 AM, Brent Royal-Gordon <brent at architechies.com> wrote:
> Anyway, my point remains: this _SwiftNativeNSError should use a userInfo property on your ErrorType to populate NSError.userInfo. There should be no need to go through the full rigamarole of calling NSError's initializer yourself—just return a dictionary at the appropriate moment.
Having a userInfo property by which I could return the dictionary would work fine, and I’d be perfectly happy with it. I’m not sure if the Swift team would be happy with such a solution, though, since it necessarily involves dynamically typed objects, whereas my proposal enforces the correct types for all of the individual objects within the userInfo dictionary; String for the failure reason, NSURL for the URL, [String] for the recovery options, etc.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution