PJeremyMalouf PJeremyMalouf - 6 months ago 32
Swift Question

Swift 3 (Omit Needless Words) causing two functions to have the same name

In Swift 3.0, the automated changing of function names due to the "Omit Needless Words" rule has caused two functions in an ObjC class to be the same.

- (void)showLoader;


- (void)show __deprecated_msg("User 'showLoader'");

The problem is that these functions are within a third party Cocoa Pod (otherwise I would just delete the unnecessary 'show' function).

This results in getting the error "Ambiguous use of 'show'" when I try to invoke the function like this:


Is there a way to reverse the automatic changing of function name in Swift 3.0 or to help the compiler know which function I want to invoke?

Thanks for your help!


You can work around this by calling


You will see a warning from the compiler, but it will compile successfully, and things will work correctly at runtime.