Same as Litho/ComponentKit

Theoodlite is built on the same ideas behind Facebook Litho and ComponentKit. The justification for all three frameworks is almost identical… so much so that I was able to just replace RecyclerView with UICollectionView from Litho’s motivation:

Performant list views are hard

Building a list interface on iOS is fairly simple. Just create a layout for the items, hook it up to a UICollectionView, and you’re done. Most apps are a bit more complicated than that, though.

Recycling is hard

If your adapter has more than a few view types, you’ll have to think about more robust ways to recycle views. If you have too many view types, UICollectionView will be constantly creating new views every time a new type is displayed, which is likely to cause frame drops while scrolling.

You can minimise the number of view types by recycling the same view instances for multiple variations within cells in UICollectionView but this usually results in a solution that will get increasingly more prone to bugs as you add more features to your product.

Standard approaches to recycling result in difficult to maintain code

If the list items are complex, chances are that you’ll have to optimize your layouts. For simpler cases, you can get good performance by simply avoiding some gotchas from UIKit’s stock layouts but this is not always the case. A common approach is to implement custom views especially tailored for your use cases. Custom views are great for UI efficiency but tend to slow you down due to the added complexity and higher maintenance cost.

You can also optimize complex items in UICollectionView by breaking them down into separate items in the adapter to better spread the time spent on layout and drawing per frame while scrolling. This approach can work well in some cases but it might still require investment in custom views and usually leads to an explosion in view types in the adapter, leading to the problems we described above.

Simpler programming model

Theodolite was primarily built to encapsulate the complexity of implementing efficient UICollectionViews. With Theodolite, there are no view types and you build user interfaces that can seamlessly compute layout ahead of time in a background thread and render much flatter view hierarchies automatically. And they get all of these fancy features for free behind a much simpler programming model!

Edit on GitHub