<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 23, 2016, at 5:11 AM, plx via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Jan 22, 2016, at 6:12 PM, Ross O'Brien via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">How would we apply this to delegate patterns?<div class="">For example, would we keep tableview(tableView:cellForRowAtIndexPath:), or would we switch to delegate(tableView:cellForRowAtIndexPath:) ?</div><div class="">Or perhaps better, for clarity over which protocol is being conformed to / which property of the delegator is calling the function:</div><div class="">dataSource(tableView:cellForRowAtIndexPath:),</div><div class="">delegate(tableView:didSelectRowAtIndexPath:)</div></div></div></blockquote><div class=""><br class=""></div><div class="">FWIW, I am personally favorable to a more radical-renaming for delegate methods, roughly the below:</div><div class=""><div class=""><div class=""><br class=""></div><div class="">func numberOfSections(inTableView tableView: UITableView) -&gt; Int // &lt;- against guidelines, but symmetric</div>func numberOfRows(inTableView tableView: UITableView, forSection section: Int) -&gt; Int</div><div class=""><div class="">func cellForRow(inTableView tableView: UITableView, atIndexPath indexPath: NSIndexPath) -&gt; UITableView</div><div class=""><br class=""></div></div></div><div class="">…where the rule is to find the “what is this method about” part of the selector, make that the name of the Swift function, and then label each argument as-necessary; the goal is for the methods to read as approximate natural-language sentences.</div><div class=""><br class=""></div><div class="">This is most definitely *not* in line with conventions, but I have found it to be *much* more readable overall; this is especially true in the case of new APIs (which don’t have the benefit of deep familiarity like the table-view and similar).</div></div></div></blockquote><br class=""></div><div>I’ve always found the delegate naming convention counterintuitive, because the important action is either in the second argument label or (when the source is the only parameter) buried in the base name.</div><div><br class=""></div><div>In truth, I’d intended to investigate whether one could automatically translate Cocoa’s delegate methods into a form much like what you’re describing, but haven’t had time to experiment with it. Personally, I think it’s a promising direction to go, if we can come up with a guideline and implement some heuristics in the Clang importer to translate Cocoa well.</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div><br class=""></div><br class=""></body></html>