Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Protocol Oriented Programming - Vahagn Gevorgyan

Protocol Oriented Programming - Vahagn Gevorgyan

As a part of https://swiftcoders.org initiative, SwiftCoders Armenia has an ambitious goal - connect passionate professionals to share their experience, create a great network and make an impact in their communities.
Our speakers are invited from the best IT companies to share their experience and knowledge.

Watch video of the presentation on YouTube
https://youtu.be/oUeMV17jYBw

Contact Vahagn:
LinkedIn: https://www.linkedin.com/in/gevorgyanvahagn/
GitHub: https://github.com/gevorgyanvahagn

Join SwiftCoders Armenia:
Website: https://swiftcoders.am
Telegram: https://t.me/SwiftCoders
Facebook: https://www.facebook.com/swiftcoders
LinkedIn: https://www.linkedin.com/company/swiftcoders-armenia/
Eventbrite: https://www.eventbrite.com/o/swiftcoders-armenia-18287883306
Decks: https://speakerdeck.com/swiftcoders
Slack: https://swiftcodersinvite.herokuapp.com/

Avatar for SwiftCoders Armenia

SwiftCoders Armenia

February 06, 2019
Tweet

More Decks by SwiftCoders Armenia

Other Decks in Programming

Transcript

  1. 1.Protocols in Swift? 2.Problem with “Fat” base classes 3.Solving the

    problem with “Protocol oriented programming” Protocol Oriented Programming in Swift
  2. protocol SomeProtocol { // protocol definition goes here } Protocols

    blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality
  3. class Car { func startEngine () { … } func

    stopEngine () { … } ... }
  4. class MercedesCLS: Car {} class AudiA5: Car {} class MercedesSLK:

    Car {} class ChevroletMonteCarlo: Car {} Cabriolet
  5. extension Cabriolet where Self: Car { func openRoof() { ...

    } func closeRoof() { ... } } Protocol Extensions Constraints extension Cabriolet where Self: Cruiser { func openRoof() { ... } func closeRoof() { ... } }