We roll our own versions of the Apple built-in Equatable and Comparable protocols, apply them to two classes, and test -- including testing in a UIKit-based Playground for presenting a user interface.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Protocols.playground
ViewWLines.playground
.gitignore
LICENSE.md
README.md

README.md

Swift-4-Protocol-Playgrounds

We're going to talk about "protocols" in the Swift 4 language today. I'll explain them conceptually, and then we'll start coding protocols with a simple example. We'll then create our own versions of the Apple built-in Equatable and Comparable protocols, and apply them to two real-world classes, one for tracking financial securities and one for representing geometric lines/vectors. Finally, we'll test our geometric "Line" class in a type of Swift playground that supports rendering user interface components (like UIView) live in the simulator.