[swift-evolution] Will Swift ever support optional methods without @objc?

Benjamin Spratling bspratling at mac.com
Mon Nov 14 18:10:11 CST 2016

Given optionals and closures, is it necessary to support optional protocols?

protocol MyProtocol {
	var titleForRow:((_ indexPath:IndexPath)->(String))? { get }

One disadvantage is that you need Obj-C, which means it doesn’t run on linux, or several other platforms.
Another disadvantage, as I understand it, is it requires slower Obj-c dispatch, instead of witness tables.  Obj-C dispatch also only considers names, not argument & return types.

> On Nov 14, 2016, at 5:48 PM, Rick Mann via swift-evolution <swift-evolution at swift.org> wrote:
> Will Swift ever support optional methods without @objc?
> What are the disadvantages of marking a protocol @objc?
> Thanks!
> -- 
> Rick Mann
> rmann at latencyzero.com
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

More information about the swift-evolution mailing list