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

How to be a POP-Star by Ritesh at SwiftChennai-4

How to be a POP-Star by Ritesh at SwiftChennai-4

Protocol Oriented Programming

Eeb061c8b2816b771920da1b3e7904a3?s=128

Swift India

April 29, 2017
Tweet

Transcript

  1. how to be a POP-Star (Swift Chennai Meetup) ~ Ritesh

    Gupta
  2. /@_riteshhh /riteshhgupta /issues/295 /swift-snippets

  3. None
  4. None
  5. `Protocol-Oriented Programming in Swift` https://developer.apple.com/videos/play/wwdc2015/408/ WWDC - 2015

  6. `Protocol and Value Oriented Programming in UIKit Apps` https://developer.apple.com/videos/play/wwdc2016/419/ WWDC

    - 2016
  7. Swift is just not a syntax migration from Objective-C…

  8. Swift is not objective-c styled language…

  9. C ~> C++ Objective-C ~> Swift { imperative } {

    object oriented } { object oriented } { protocol oriented }
  10. Entity (class, struct - UI or Model) vs Behaviour (protocol)

  11. Entity is collection of behaviours…

  12. UIButton UIBarButtonItem

  13. UIBarButtonItem UIBarItem NSObject UIButton UIControl UIView

  14. UIBarButtonItem UIBarItem NSObject UIButton UIControl UIView

  15. None
  16. None
  17. UIKit + Protocols

  18. UIView Framable

  19. UIImageView ImageRenderable, Framable

  20. UIButton Tappable, ImageRenderable, Framable

  21. compose everything with Protocols..

  22. UITableViewCell
 UICollectionViewCell Reusable, Framable

  23. UIScrollView Scrollable, Framable

  24. UITableView
 UICollectionView Listable, Scrollable, Framable

  25. thinking in protocol..

  26. protocol ->

  27. protocol -> protocol extension ->

  28. protocol -> protocol extension -> protocol 
 constrained extension ->

  29. playground demos..

  30. protocol is not a silver bullet.. http://chris.eidhof.nl/post/protocol-oriented-programming/

  31. ..computed variables, extensions, values types, immutability, functional programming, generics, enums,

    associative types/ values..
  32. None