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

Onion-like app architecture

Onion-like app architecture

Learn how to architect an entire app – from UI, through user / data flows and transactions down to data storage and delivery – in independent, interchangeable layers. With layers that can be freely combined as needed, with no or minimal disruption to the rest of app. Just like an onion. You will learn that MVC is excellent, if employed properly. You will learn how to use Coordinators without delegates and with truly minimal UIKit extensions. Learn about an approach suitable for iOS teams of one and teams of 1000 developers. For 5 screen apps and for 200+ UIViewController behemots.

https://github.com/radianttap/Coordinator

https://github.com/radianttap/Spotifier

Video: https://www.youtube.com/watch?v=kD8dRvEQ5II

More Decks by Aleksandar Vacić (Radiant Tap)

Other Decks in Technology

Transcript

  1. Aleksandar Vacić
    @radiantav
    O N I O N - L I K E A P P A R C H I T E C T U R E
    App Builders 2019

    View full-size slide

  2. Aleksandar Vacić
    Belgrade, Serbia
    radianttap.com
    aplus.rs
    @radiantav

    View full-size slide

  3. Why architecture?
    architecture?

    View full-size slide

  4. HomeController
    ProductDetailsController
    ProductsController

    View full-size slide

  5. Architecture of complex apps
    is ever evolving, quite often
    in unforseen ways.

    View full-size slide

  6. Fashion SPORTS BETTING Sales

    View full-size slide

  7. · 100+ screens (few dozen are multi-screen flows)
    · multiple external services
    · 10+ languages (with runtime updates)
    · 20+ markets in Europe, Africa and S. America
    · iOS, tvOS, watchOS, widgets
    · Notifications, deep links, home screen actions
    SPORTS BETTING
    · Unpredictable future expansion

    View full-size slide

  8. Connect to web services
    Import into local storage
    Cache temporary data
    Directly target any screen, at any depth
    Transform any 3rd party data model into my own
    Multi-screen user flow
    Multi-service data flow
    Multi-OS reusability
    Reading data is always super performant
    c h a l l e n g e s

    View full-size slide

  9. Build complex system that works
    by first building a simple system
    that works.
    Break complex, multi-faceted flows
    into self-sufficient steps.
    Then compose them back.
    p r i n c i p l e s

    View full-size slide

  10. Data Source
    Data Delivery
    Data Storage
    DATA MODEL

    View full-size slide

  11. Data Source
    Data Delivery
    Data Storage
    web service, bundled file,
    cached download
    URLSession, FileManager,
    Authentication, Encryption
    Core Data, mobile db,
    in-memory, file / custom store

    View full-size slide

  12. Data
    UI
    UI Coordinators

    View full-size slide

  13. UI
    UI Coordinators
    Data

    View full-size slide

  14. UI
    UI Coordinators
    Middleware
    Data

    View full-size slide

  15. Data Source
    Data Delivery
    Data Storage
    UI
    UI Coordinators
    Middleware
    L A Y E R S
    DATA MODEL

    View full-size slide

  16. O N I O N
    It resembles , isn’t it?

    View full-size slide

  17. O N I O N
    G A R L I C
    It resembles , isn’t it?

    View full-size slide

  18. Data Source
    Data Delivery
    Data Storage
    UI
    UI Coordinators
    Middleware
    L A Y E R E D
    DATA MODEL
    KEEP IT
    & SIMPLE

    View full-size slide

  19. Coordinator

    Advanced implementation of said pattern in
    Swift, including care-free messaging through
    UIResponder chain.
    Avenue

    URLSession wrapper, handles boilerplate,
    enables seamless usage with
    Operation(Queue).
    Ambar

    Custom Core Data stack with automatic merge
    of background imports into main MOC.
    / radianttap

    View full-size slide

  20. DEMO
    radianttap
    / Spotifier
    /

    View full-size slide

  21. What were my problems, or…
    KILS Architecture Benefits
    Builds on system frameworks
    ɠ
    Rapid iterations
    ɡ
    Painless refactoring
    ɢ
    Low maintenance cost
    ɣ

    View full-size slide

  22. / radianttap
    SpeakerDeck.com / radianttap
    aplus.rs
    Aleksandar Vacić, radianttap.com
    @radiantav
    SLIDES
    DEV BLOG
    CONTACT

    View full-size slide