<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=""><div class="">A couple of points to think about:</div><div class=""><br class=""></div><div class="">- Seems to me like Swift's error handling should be discussed at the same time because asynchronous callbacks is the only case where we need to revert back to using NSError instead of using Swift’s error handling. What can the language do for us?</div><div class=""><br class=""></div><div class="">- This is slightly off-topic, but do we profit from Swift as a new language to move to a completely different paradigm like Promises?</div><div class=""><br class=""></div><div class="">David</div><br class=""><div><blockquote type="cite" class=""><div class="">On 03 Dec 2015, at 23:15, Douglas Gregor &lt;<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 3, 2015, at 12:32 PM, Dan Stenmark &lt;<a href="mailto:daniel.j.stenmark@gmail.com" class="">daniel.j.stenmark@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">There’s a some of debate in the community regarding best practice for asynchronous completion callbacks. &nbsp;These practices include:<div class=""><br class=""></div><div class="">- Single Block w/ Mutually Exclusive Result and Error Objects (the current standard convention in Cocoa, though originally designed with Objective-C in mind)</div><div class="">- Double Block (one for success, one for failure)</div><div class="">- Swift Enum w/ Associated Objects (as described here:&nbsp;<a href="http://www.developerdave.co.uk/2015/09/better-completion-handlers-in-swift/" class="">http://www.developerdave.co.uk/2015/09/better-completion-handlers-in-swift/</a>)</div><div class=""><br class=""></div><div class="">Even prior to Swift, Apple’s code guidelines never explicitly addressed this topic. &nbsp;Going forward into the brave new world of Swift, are there going to be new preferred API design guidelines for this?</div></div></div></blockquote><br class=""></div><div class="">This is a great point, and there are a number of other issues related to callbacks/closure arguments that would benefit from guidelines. For example, I've seen the “Double Block” case where the second block ends up being a trailing closure, which makes for non-intuitive uses.</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>- Doug</div><div class=""><br class=""></div><br class="">
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=nE9rxSXA5G4kxsTVkgv43hXwizS3O2z60WweqomIrdiePrUsq-2F-2BEg9vdY9Y4B3eRmEdtQ-2FlyOUZ3KyIILGCEuhmZCCZv51Goh2vptSwHCUTi1vUVeJGXyD100uXQMZAIuqF3Kr7hOwuDk3B-2FWjt0paLFZmum3koP-2BYMeTE1jR9xlhxXRTXEEKiJvdA-2BdgpmhuZneOLGFvIe3MH1wX3GeuV-2FfZBGUVacIDNxx-2Flo3zBU-3D" alt="" width="1" height="1" border="0" style="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;" class="">
</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>