Pro Swift and Swift Algorithms

A couple of extra books to consider if you are learning Swift that did not make my recent round up of new iOS books.

Pro Swift

Author: Paul Hudson
Website: Hacking With Swift

This book came highly recommended by a number of people and reminds me of another book on my bookshelf - Effective Objective-C 2.0 by Matt Galloway in that it is a series of articles loosely organised around seven main themes. Oh and it includes over 70 videos if you prefer to learn by watching rather than reading.

Pro Swift

It is not a learn Swift book (check Paul's other book Hacking With Swift for that). What it will do is help you progress beyond the basics to a deeper understanding of the Swift way to do things (a free update to Swift 3.0 is planned). You can read this cover to cover but it is also great to dip into when you are struggling with a topic.

The seven chapters cover a real mix of topics:

  • Chapter 1 Syntax: pattern matching, Nil coalescing, Guard, Lazy loading, Destructuring (pulling data in and out of tuples), Labeled statements, Nested functions, classes and structs, Documentation markup
  • Chapter 2 Types: Useful initializers, Enums, Computer properties and methods, Arrays, Sets, Tuples, Generics
  • Chapter 3 References and Values: What's the difference, Closures are references, Why use structs?, Why use classes?, Choosing between structs and classes, Mixing classes and structs, Immutability
  • Chapter 4 Functions: Variadic functions, Operator overloading, Closures, The ~= operator
  • Chapter 5 Errors: Error fundamentals, Error propagation, Throwing functions as parameters, try vs try? vs try!, Assertions
  • Chapter 6 Functional Programming: What is functional programming, map(), flatMap(), Optional flat map, filter(), reduce(), sort(), Function composition, Lazy functions, Functors and monads
  • Chapter 7: Patterns: Object-oriented programming, Protocol-oriented programming, MVC, MVVM, Command-line Swift

As you can see, there is something for everybody. A great addition to my Swift bookshelf.

Swift Algorithms & Data Structures

Author: Wayne W Bishop

At time of writing a second edition that promises extended content and Swift 3.0 updates is available for pre-order.

Swift Algorithms & Data Structures

This is an interesting project by Wayne W Bishop to practise common programming techniques for technical interviews using Swift. The code and selected essays are open source to encourage wide review.

The list of algorithms and data structures that it covers is long and organised as a series of essays:

  • Big O Notation, Sorting, Linked Lists, Generics, Binary Search Trees, Tree Balancing, Tries, Stacks & Queues, Graphs, Shortest Paths, Heaps, Traversals, Hash Tables, Closures

Each essay is concise and easy to read with links to related Wikipedia articles if you want to dig deeper into theory. What makes it interesting if you are learning Swift is that the code introduces you to some common Swift features such as generics and optionals in a way that feels less contrived than in many Swift books. If you learn by seeing practical examples this approach will be of interest to you.