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

A Case Study - Rewriting our Home Feed in JC

Avatar for Daniel okanin Daniel okanin
July 20, 2022
25

A Case Study - Rewriting our Home Feed in JC

Avatar for Daniel okanin

Daniel okanin

July 20, 2022

Transcript

  1. Why rewrite our Home Feed in Jetpack Compose? 1. Required

    API migration work 2. We were there anyway 3. Why not try something new?
  2. Home Feed, what are you made of? • Various Cards:

    Photos, Products, Stories, Ads, Banners • Carousels: Photos, Videos (playing inline), Custom Layouts • Includes: Caching, Refresh Pill, Pagination, Tracking Items and more… • Millions of visits every week • The first page the users see when they enter the app
  3. @Stable • The result of equals will always return the

    same result for the same two instances. • When a public property of the type changes, composition will be notified. • All public property types are stable.
  4. When can using Transformers help us? • When the Compose

    Compiler is not defined in the module your object is defined in • Unlike the original model, your UI model consists of primitives only • Annotating the UI model with @immutable or @Stable is safer as there are no side-effects affecting other places in the app.
  5. Summary Instead of Using Replace With var val Collections classes

    like: List, Set and Map • Kotlinx immutable collections • Use @immutable/@stable annotations Classes from modules with no dependency on compose runtime • Enable compose compiler • UI models • Wrapper classes and use @immutable/@stable annotations