Translate Optional Delegate Protocol Methods to Swift Block-based Event Handlers Using Nested Objects
Found this little gem in a library called NextGrowingTextView
, shortened to make the point clear with less code. It’s a collection of block-based event handlers in a little class:
Block-Based API vs. Delegates – a Comparison
As I’m exploring the use of block based API, which means to assign closures or functions handles to properties or pass them around as parameters to other functions, I found a few benefits and drawbacks in comparison to protocol-based object interactions. Here’s a breakdown of criteria for blocks and delegates.