Creating a Swift Collection

Posted on Mon 16 February 2015 in development • Tagged with swift

Let's say you'd like to create your own collection class. In this example, it's going to be a collection of books that only allow the addition of a new book if it's written by a select list of your favorite authors.

typealias Book = (title: String, author: String)

struct MyCollection {

    private …

Continue reading