$30 off During Our Annual Pro Sale. View Details »

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. A short story about Love 1. Friendship 2. Love 3.

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

    Doubt 4. Betrayal 5. Starting over again 6. Rebuild the trust @EliSawic
  3. 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
  4. 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
  5. 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