Skip to content

Latest commit

 

History

History
6 lines (4 loc) · 549 Bytes

File metadata and controls

6 lines (4 loc) · 549 Bytes

Protocol Oriented Programming in Swift, Part 1 of 2

Here are two Xcode 9 playgrounds written in Swift 4 that highlight protocol oriented programming and value semantics.

Protocol Polymorphism.playground demonstrates polymorphism inherent in Swift's protocols.

Generic List.playground shows you how to build generic data structures in Swift -- a queue and a stack that can contain any type. It also demonstrates how you can build powerful protocols by inheriting from other ones without the interference you'd get from class inheritance.