""Hi,
consider this ObjC class (.m file is not relevant, so not shown)
@interface Bar: NSObject
- (void)barWithString:(NSString *)string;
- (void)barWithInteger:(NSInteger)integer;
@end
If from a Swift file I try to create this selector
let selector = #selector((Bar.bar) as (Bar) -> (String) -> (Void))
the compiler does not complain. The casting to that specific signature is resolved and life is good.
Now considering this simple ObjC protocol
@protocol Doable
- (void)doSomethingWithString:(NSString *)string;
- (void)doSomethingWithInteger:(NSInteger)integer;
@end
I am trying to create a selector the same way
let selector = #selector((Doable.doSomething) as (Doable) -> (String) -> (Void))
but this time the compiler hits me with "Ambiguous reference to member 'doSomething(with:)'"
Can someone explain why this different behavior?
Thanks
Best
.pm