I\'m trying to raise an exception in Swift by calling NSException.raise(). The definition is:
class func raise(_ name: String!, format format: String!, arguments
The problem seems to have been that I didn't treat the error as an optional. The following works:
var error: NSError?
NSException.raise("Exception", format:"Error: %@", arguments:getVaList([error!]))
Or you could do the following in case error is nil:
NSException.raise("Exception", format:"Error: %@", arguments:getVaList([error ?? "nil"]))