[swift-evolution] [Proposal] Make optional protocol methods first class citizens

Thorsten Seitz tseitz42 at icloud.com
Fri Apr 1 11:55:54 CDT 2016

Good point. That would obviously restrict the choice for naming the methods in such a protocol, but since we are talking about new protocols that would not be an impediment. It might result in non-optimal method names, of course.


> Am 31.03.2016 um 18:37 schrieb Rob Mayoff via swift-evolution <swift-evolution at swift.org>:
>> On Thu, Mar 31, 2016 at 10:56 AM, Thorsten Seitz via swift-evolution <swift-evolution at swift.org> wrote:
>> protocol UIGestureRecognizerDelegate {
>>     var gestureRecognizerShouldBegin: ((gestureRecognizer: UIGestureRecognizer) -> Bool)? { get }
>> }
> UIGestureRecognizerDelegate has five methods that are "named" gestureRecognizer:
> gestureRecognizer(_:shouldRecognizeSimultaneouslyWithGestureRecognizer:)
> gestureRecognizer(_:shouldRequireFailureOfGestureRecognizer:)
> gestureRecognizer(_:shouldBeRequiredToFailByGestureRecognizer:)
> gestureRecognizer(_:shouldReceiveTouch:)
> gestureRecognizer(_:shouldReceivePress:)
> You can only have a single property named "gestureRecognizer", so you either have to come up with other names for these, or change the language to allow closure-typed properties to have multipart names.
> This problem has been noted before, for example here: http://article.gmane.org/gmane.comp.lang.swift.evolution/8707/
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160401/3e831d38/attachment.html>

More information about the swift-evolution mailing list