Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Protocol Oriented Programming

Avatar for Rahul Rahul
September 28, 2019

Protocol Oriented Programming

Advantages of Swift Protocols & POP over conventional OOPs methodology. How Protocols help with injecting, testing and abstracting the code.

Speaker: Rahul Khanna, Lead iOS Engineer at OLX India
https://www.linkedin.com/in/rahul-khanna-27266720/
https://twitter.com/IamRKhanna

Presented at Swift Delhi Chapter 21 hosted by OLX India
https://www.meetup.com/Swift-Delhi/events/264744621/

Avatar for Rahul

Rahul

September 28, 2019
Tweet

Other Decks in Programming

Transcript

  1. What is a Swift Protocol? A protocol defines a blueprint

    of methods, properties, and other requirements that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementation of those requirements. - Apple Docs
  2. Why use Protocols? • Retroactive conforming ◦ Allows one to

    take types from a library and protocols from another library and make them work nicely together • Not monolithic • Can be adopted by classes/structs/enums • Encourages the use of value types ◦ Prevents unintended sharing of objects in code • Composition ◦ Multiple conformance • Inheritable • Unit Testing
  3. Want more? Protocol-Oriented Programming in Swift - Dave Abrahams Practical

    Protocol-Oriented-Programming - Natasha Murashev