I depend on a legacy C++ library for which I need to build a bridge into Swift. The API is similar to a standard XML DOM and a database-like queries at the same time. Querying for a property of an object can return a value (e.g. Int), absence of a value (nil) or an error (something went wrong). Ideally I would like to have a Swift call like this:
func getInt() throws -> NSNumber?It seems, it is not possible with the current Swift 2 compiler since the Objective-C method
-(NSNumber*)getIntWithError:(NSError**)errorwill translate into
func getInt() throws -> NSNUmberIt doesn't seem to be possible to express that the result is actually optional. I have already posted a bug report, however may someone have an idea for a workaround?
Thanks a lot in advance!