Swift - Allow adding functions with implementation to protocols

Originator:jan.sabbe
Number:rdar://17412469 Date Originated:2014-06-22
Status:Duplicate Resolved:2014-06-23
Product:Developer tools Product Version:
Classification:Feature (New) Reproducible:Always
 
We currently have a nice generic function 'contains' that works on anything that implements a Sequence: contains([1,2,3],1)
It would be nicer if I could write [1,2,3].contains(1). It is also more easily discoverable by a developer using code completion. Yet it would still be nice to keep the function generic, so it really belongs on the protocol itself. See also the default methods in Java 8 interfaces.

If you implement two protocols with a same default method signature, there should also be some syntax to choose the preferred implementation (or override it completely)

Comments

Duplicate of 14011860


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!