<div dir="ltr"><div>How about reusing the keyword "required" for this? It's already used (and has a similar meaning) for initializers.</div><div><br></div>I think NSSecureCoding is a good example of a use case.<div class="gmail_extra">
<br><div class="gmail_quote">On Sat, Dec 12, 2015 at 9:14 AM, Arthur Ariel Sabintsev via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>TL;DR: Force explicit protocol conformance of non-optional methods for child classes on an opt-in basis.<br></div><div><br></div><div>Currently, a child class that inherits their parent class' protocol conformations are not explicitly required to override their parent classes implementation of a protocol. For example, a custom class, MyTableViewController, does not explicitly have to override the non-optional methods of the protocols (i.e., UITableViewDataSource, UITableViewDelegate) to which UITableViewController conforms. </div><div><br></div><div>For many protocols, the superclass implementation of a protocol method may be enough. Therefore, this feature should off by default, and only enabled if the creator of the protocol requires it (for whatever reason). I suggest using a new `@abstract` attribute to designate if a protocol requires explicit conformance for children of a conforming parent class. This choice of naming for the attribute is along the lines of what other languages call an Abstract Class, which is what I'm trying to have added to Swift in this fairly long-winded post.</div><div><br></div><div>@abstract protocol P: class {</div><div> // All methods defined in here would need to be explicitly overridden by the conforming class's children.</div><div>}</div><div><br></div><div>If you want to have optional methods in your protocol, then using the @abstract attribute gets kind of messy, as you also have the @objc attribute.</div><div><div><br></div></div><div><div>@abstract @objc protocol P: class {</div><div> // All non-optional methods defined in here would need to be explicitly overridden by the conforming class's children.</div><div>}</div></div><div><br></div><div>Thoughts?</div><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div style="color:rgb(0,0,0);font-family:helvetica,arial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif">Best,</span></div><div style="color:rgb(0,0,0);font-family:helvetica,arial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div style="color:rgb(0,0,0);font-family:helvetica,arial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif">Arthur / <a href="http://sabintsev.com/" target="_blank">Sabintsev.com</a> </span></div></div></div></div></div></div>
</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=P-2BsYbBZHRBuLDBJaL4DIKDNfkkjpROowTyRAObV11qyf9TrVrNYaL84Rri5s9qM11YW1Mfb1AE9cqjoU74iJuLW7tpuD-2FBg3nI5QsF7Sgie-2F4JfYNSFbZaEUdGUdDYFUfoEtnxxdt37exlbG1jADavMXCdObmN9rMsONQa9B-2BVBXSNZSc3VHSUWBv-2FBkVwfKtPiBhylGtBqsg5vxOJ8qk8xcCU5QWOtxi-2FhulhoBE-2B4-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>