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

Jon Shier jon at jonshier.com
Fri Aug 5 16:57:48 CDT 2016


Swifters:
	I’m attempting to update some library code to beta 4 and I’ve run into something that’s either a bug or a deliberate change. In a class that’s a Foundation.Operation subclass, there are two finish() functions:

final func finish(_ receivedErrors: [Error] = []) {
    _finish(receivedErrors, fromCancel: false)
}

/// Convenience method to simplify finishing when there is only one error.
final func finish(_ receivedError: Error?) {
    finish(receivedError.map { [$0]} ?? [])
}

Prior to beta 4 these functions lived side by side quite happily. In beta 4, however, their existence produces this error:

method 'finish' with Objective-C selector 'finish:' conflicts with previous declaration with the same Objective-C selector

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



Jon Shier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160805/733457b3/attachment.html>


More information about the swift-users mailing list