With the advent of protocol-oriented programming Swift types are able to adopt all sorts of super powers with minimal work.
But sometimes it's not clear what that minimal work is.
SequenceType, for example, simply requires that you implement func generate(); you get everything else for free.
This article provides copy-pastable snippets that represent the minimal implementation required to conform to a given protocol. Please feel free to suggest additional implementations by tweeting @featherless with a GitHub gist.
Your new post is loading...