[swift-evolution] API Guidelines for Asynchronous Completion Handlers?
daniel.j.stenmark at gmail.com
Thu Dec 3 14:32:03 CST 2015
There’s a some of debate in the community regarding best practice for asynchronous completion callbacks. These practices include:
- Single Block w/ Mutually Exclusive Result and Error Objects (the current standard convention in Cocoa, though originally designed with Objective-C in mind)
- Double Block (one for success, one for failure)
- Swift Enum w/ Associated Objects (as described here: http://www.developerdave.co.uk/2015/09/better-completion-handlers-in-swift/ <http://www.developerdave.co.uk/2015/09/better-completion-handlers-in-swift/>)
Even prior to Swift, Apple’s code guidelines never explicitly addressed this topic. Going forward into the brave new world of Swift, are there going to be new preferred API design guidelines for this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution