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

Flying away from the nest (Bye Bye UIKit)

Flying away from the nest (Bye Bye UIKit)

From the very beginning of your journey as iOS developer, UIKit is always there to help you. It helps you to walk your first steps, populate table views, handle notifications, create beautiful layouts and more. But as time goes by, you become more experienced and some day you realise that you have to leave the nest and become less dependent on UIKit. Let’s check how this turns out for you and see if we really need UIKit and iOS simulator to run and test our code.

Also known as "Short story about love"

Eliasz Sawicki

April 12, 2017
Tweet

Other Decks in Programming

Transcript

  1. Flying away from the
    nest
    (Bye bye UIKit)
    @EliSawic

    View full-size slide

  2. About me
    Eliasz Sawicki
    Blog: www.eliaszsawicki.com
    Twitter: @EliSawic
    www.brightinventions.pl
    @EliSawic

    View full-size slide

  3. A short story about
    Love
    @EliSawic

    View full-size slide

  4. A short story about Love
    1. Friendship
    @EliSawic

    View full-size slide

  5. A short story about Love
    1. Friendship
    2. Love
    @EliSawic

    View full-size slide

  6. A short story about Love
    1. Friendship
    2. Love
    3. Doubt
    @EliSawic

    View full-size slide

  7. A short story about Love
    1. Friendship
    2. Love
    3. Doubt
    4. Betrayal
    @EliSawic

    View full-size slide

  8. A short story about Love
    1. Friendship
    2. Love
    3. Doubt
    4. Betrayal
    5. Starting over again
    @EliSawic

    View full-size slide

  9. A short story about Love
    1. Friendship
    2. Love
    3. Doubt
    4. Betrayal
    5. Starting over again
    6. Rebuild the trust
    @EliSawic

    View full-size slide

  10. How does it end?
    @EliSawic

    View full-size slide

  11. Friendship
    @EliSawic

    View full-size slide

  12. Objective-C
    @EliSawic

    View full-size slide

  13. The UIKit
    @EliSawic

    View full-size slide

  14. Why do we need
    UIKit?
    @EliSawic

    View full-size slide

  15. Love
    @EliSawic

    View full-size slide

  16. Swift
    @EliSawic

    View full-size slide

  17. Tests!
    @EliSawic

    View full-size slide

  18. Why do we need
    tests?
    @EliSawic

    View full-size slide

  19. Why cars need
    brakes?
    @EliSawic

    View full-size slide

  20. Test Driven
    Development
    @EliSawic

    View full-size slide

  21. Doubt
    @EliSawic

    View full-size slide

  22. Slow feedback loops
    @EliSawic

    View full-size slide

  23. Long build times
    @EliSawic

    View full-size slide

  24. No tests for you today
    @EliSawic

    View full-size slide

  25. Betrayal
    @EliSawic

    View full-size slide

  26. React-Native
    @EliSawic

    View full-size slide

  27. Testing feels natural
    @EliSawic

    View full-size slide

  28. Qucik reloading
    @EliSawic

    View full-size slide

  29. Starting over again
    @EliSawic

    View full-size slide

  30. What was the
    problem?
    @EliSawic

    View full-size slide

  31. Slow feedback loop
    @EliSawic

    View full-size slide

  32. Long build times
    @EliSawic

    View full-size slide

  33. Rebuild the trust
    @EliSawic

    View full-size slide

  34. MVC
    @EliSawic

    View full-size slide

  35. MVC
    @EliSawic

    View full-size slide

  36. MVVM
    @EliSawic

    View full-size slide

  37. MVVM
    @EliSawic

    View full-size slide

  38. Why would you
    remove UIKit?
    @EliSawic

    View full-size slide

  39. struct Person {
    var firstName: String
    var lastName: String
    var birthday: Date
    }
    @EliSawic

    View full-size slide

  40. class PersonView: UIView {
    private var person: Person
    private var dateFormatter = DateFormatter()
    init(person: Person) {
    self.person = person
    super.init(frame: .zero)
    setupView()
    }
    private func setupView() {
    dateFormatter.dateStyle = .short
    birthdayLabel.text = dateFormatter.string(from: person.birthday)
    titleLabel.text = person.firstName + person.lastName
    }
    func workButtonTapped() {
    // Some complicated logic
    }
    }
    @EliSawic

    View full-size slide

  41. protocol PersonViewModel {
    var title: String {get}
    var birthday: String {get}
    func doSomeWork()
    }
    class PersonView: UIView {
    private var viewModel: PersonViewModel
    init(viewModel: PersonViewModel) {
    self.viewModel = viewModel
    super.init(frame: .zero)
    setupView()
    }
    private func setupView() {
    titleLabel.text = viewModel.title
    birthdayLabel.text = viewModel.birthday
    }
    func workButtonTapped() {
    viewModel.doSomeWork()
    }
    }
    @EliSawic

    View full-size slide

  42. class DetailedPersonViewModel: PersonViewModel {
    var title: String
    var birthday: String
    var dateFormatter = DateFormatter()
    init(person: Person) {
    title = person.firstName + " " + person.lastName
    dateFormatter.dateStyle = .short
    birthday = dateFormatter.string(from: person.birthday)
    }
    func doSomeWork() {
    // Some complicated logic
    }
    }
    @EliSawic

    View full-size slide

  43. Dumb Views
    @EliSawic

    View full-size slide

  44. Logic
    @EliSawic

    View full-size slide

  45. Why are they still
    together?
    @EliSawic

    View full-size slide

  46. Multiple targets
    @EliSawic

    View full-size slide

  47. One for UIKit
    @EliSawic

    View full-size slide

  48. One for logic
    @EliSawic

    View full-size slide

  49. Two for Tests
    @EliSawic

    View full-size slide

  50. Better architecture
    @EliSawic

    View full-size slide

  51. Easier to maintain
    @EliSawic

    View full-size slide

  52. Speeded up tests
    @EliSawic

    View full-size slide

  53. Faster builds
    @EliSawic

    View full-size slide

  54. Can they be faster?
    @EliSawic

    View full-size slide

  55. Long time ago...
    @EliSawic

    View full-size slide

  56. Something went
    wrong
    @EliSawic

    View full-size slide

  57. Flow Controllers
    @EliSawic

    View full-size slide

  58. MVVM + FlowControllers
    @EliSawic

    View full-size slide

  59. Work on your flow
    @EliSawic

    View full-size slide

  60. Feel young again
    @EliSawic

    View full-size slide

  61. Code or didn't
    happen
    @EliSawic

    View full-size slide

  62. How does it end?
    @EliSawic

    View full-size slide

  63. It depends on you
    @EliSawic

    View full-size slide