Skip to content

Instantly share code, notes, and snippets.

@sylvanaar
Created March 9, 2016 21:26
Show Gist options
  • Save sylvanaar/3315139169a0c9bc4877 to your computer and use it in GitHub Desktop.
Save sylvanaar/3315139169a0c9bc4877 to your computer and use it in GitHub Desktop.
ambiguous reference
// Ojc Category on NSError
@interface NSError (MyCategory)
+ (NSError *) clientErrorWithCode: (NSInteger) code;
@end
// Swift Error Enum
@objc enum AppError : Int {
case Foo = 0
case Bar = 1
}
// Swift Extension on NSError
extension NSError {
func clientErrorWithCode(code:AppError) {
NSError.clientErrorWithCode(code.rawValue)
}
}
// Try to use:
let error = NSError.clientErrorWithCode(.Foo) // Error: Error:(268, 40) ambiguous reference to member 'clientErrorWithCode'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment