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

Swift Lille Meetup #1 - @CallMeSH - Building interfaces like Lego Blocks

Swift Lille Meetup #1 - @CallMeSH - Building interfaces like Lego Blocks

Comment utiliser la POO, les génériques et le UIViewController containment pour coder proprement des choses très complexes en les cassant en petits bouts sur lesquels il est plus simple de raisonner. Retour d’expérience par Charles-Henri DUMALIN, développeur iOS et Back-end Freelance.

Swift Lille

January 15, 2019
Tweet

More Decks by Swift Lille

Other Decks in Technology

Transcript

  1. Oh by the way, we would like the same behaviour

    in a completely different tab
  2. Something that can display a horizontal list of shops Something

    that can display a list of horizontal lists Something that can display a horizontal list of shops Something that can display a horizontal list of shops 1. Break it down to an abstract level
  3. What if I told you •Composing UIViewController is not hard

    •And the performances are just fine!
  4. How do you compose UIViewController ? •addChild() •view.addSubview() •Deal with

    the layout •child.didMove(toParent: self) ✅ Done If the controller can be hidden you should removeChild()
  5. I made a very boring talk about this… Perfect if

    you can’t fall asleep youtube.com/watch?v=4j6nq92X5YM
  6. A UIViewController that can display a horizontal list of shops

    A UIViewController that can display a list of horizontal lists A UIViewController that can display a horizontal list of shops A UIViewController that can display a horizontal list of shops 1. Break it down to an abstract level
  7. A UIViewController that can display a horizontal list of shops

    A UIViewController that can display a list of horizontal lists A UIViewController that can display a horizontal list of shops A UIViewController that can display a horizontal list of shops And reuse it! A UIViewController that can display a horizontal list of products A UIViewController that can display a list of horizontal lists A UIViewController that can display a horizontal list of products A UIViewController that can display a horizontal list of products
  8. 2. Keep it abstract A UIViewController that can display a

    horizontal list of shops A UIViewController that can display a list of horizontal lists A UIViewController that can display a horizontal list of shops A UIViewController that can display a horizontal list of shops A UIViewController that displays a bar that collapses by observing a list of horizontal lists
  9. 2. Keep it abstract A UIViewController that can display a

    horizontal list of shops A UIViewController that can display a list of horizontal lists A UIViewController that can display a horizontal list of shops A UIViewController that can display a horizontal list of shops A UIViewController that displays a bar that collapses by observing a list of horizontal lists
  10. 2. Keep it generic A UIViewController that can display a

    horizontal list of shops A UIViewController that can display a list of horizontal lists A UIViewController that can display a horizontal list of shops A UIViewController that can display a horizontal list of shops A UIViewController that displays a bar that collapses by observing a list of horizontal lists A UIViewController having scrollable content A UIViewController that displays a bar that collapses by observing a controller containing scrollable content
  11. And reuse it again! A UIViewController listing shops A UIViewController

    that displays a bar that collapses by observing a controller containing scrollable content A UIViewController listing products A UIViewController that displays a bar that collapses by observing a controller containing scrollable content
  12. Why is it powerful ? ♻ Reusable anywhere Provide error

    handling 9 Reload support is one delegate away
  13. It’s time for your kind of controller! A RefreshController that

    makes a scrollable controller have a pull to refresh!
  14. It’s time for your kind of controller! A KeyboardController that

    handles the keyboard avoidance for any other controller.
  15. If you want to go further… UIKonf18 – Day 1

    – Joachim Kurz – MVC is Not Your Problem