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 Slide

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

    View Slide

  3. A short story about
    Love
    @EliSawic

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View 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 Slide

  10. How does it end?
    @EliSawic

    View Slide

  11. Friendship
    @EliSawic

    View Slide

  12. Objective-C
    @EliSawic

    View Slide

  13. The UIKit
    @EliSawic

    View Slide

  14. Why do we need
    UIKit?
    @EliSawic

    View Slide

  15. Love
    @EliSawic

    View Slide

  16. Swift
    @EliSawic

    View Slide

  17. Tests!
    @EliSawic

    View Slide

  18. Why do we need
    tests?
    @EliSawic

    View Slide

  19. Why cars need
    brakes?
    @EliSawic

    View Slide

  20. Test Driven
    Development
    @EliSawic

    View Slide

  21. Doubt
    @EliSawic

    View Slide

  22. Slow feedback loops
    @EliSawic

    View Slide

  23. Long build times
    @EliSawic

    View Slide

  24. No tests for you today
    @EliSawic

    View Slide

  25. Betrayal
    @EliSawic

    View Slide

  26. React-Native
    @EliSawic

    View Slide

  27. Testing feels natural
    @EliSawic

    View Slide

  28. Qucik reloading
    @EliSawic

    View Slide

  29. Starting over again
    @EliSawic

    View Slide

  30. What was the
    problem?
    @EliSawic

    View Slide

  31. Slow feedback loop
    @EliSawic

    View Slide

  32. Long build times
    @EliSawic

    View Slide

  33. Rebuild the trust
    @EliSawic

    View Slide

  34. MVC
    @EliSawic

    View Slide

  35. MVC
    @EliSawic

    View Slide

  36. MVVM
    @EliSawic

    View Slide

  37. MVVM
    @EliSawic

    View Slide

  38. Why would you
    remove UIKit?
    @EliSawic

    View Slide

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

    View 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 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 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 Slide

  43. Dumb Views
    @EliSawic

    View Slide

  44. Logic
    @EliSawic

    View Slide

  45. Why are they still
    together?
    @EliSawic

    View Slide

  46. Multiple targets
    @EliSawic

    View Slide

  47. One for UIKit
    @EliSawic

    View Slide

  48. One for logic
    @EliSawic

    View Slide

  49. Two for Tests
    @EliSawic

    View Slide

  50. Better architecture
    @EliSawic

    View Slide

  51. Easier to maintain
    @EliSawic

    View Slide

  52. Speeded up tests
    @EliSawic

    View Slide

  53. Faster builds
    @EliSawic

    View Slide

  54. Can they be faster?
    @EliSawic

    View Slide

  55. Long time ago...
    @EliSawic

    View Slide

  56. Something went
    wrong
    @EliSawic

    View Slide

  57. Flow Controllers
    @EliSawic

    View Slide

  58. MVVM + FlowControllers
    @EliSawic

    View Slide

  59. Work on your flow
    @EliSawic

    View Slide

  60. Feel young again
    @EliSawic

    View Slide

  61. Code or didn't
    happen
    @EliSawic

    View Slide

  62. How does it end?
    @EliSawic

    View Slide

  63. It depends on you
    @EliSawic

    View Slide