[swift-users] Two Obj-C visible functions no longer overload?

Quinn "The Eskimo!" eskimo1 at apple.com
Mon Aug 8 05:33:31 CDT 2016

On 5 Aug 2016, at 22:57, Jon Shier via swift-users <swift-users at swift.org> wrote:

> Now, if I mark one of the functions @nonobjc, it compiles. So is this a bug or change in behavior?

NSOperation has a property with `-finished:` as the setter and `-isFinished` as the getter.  It’s not uncommon for method names used by an operation’s author to collide with these, depending on exactly how the importing is importing those methods, how the overlays are set up, and so on.

IMO the best way to fix your specific issue is to adopt Swift 3 naming for your methods:

    final func finish(receivedErrors: [Error])    
    final func finish(receivedError: Error?)

which lifts you out of the ‘finish’ space entirely.

Share and Enjoy
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

More information about the swift-users mailing list