Jetpack Compose internals

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Jetpack Compose is the future of Android UI. Master how it works internally and become a more efficient developer with it. You'll also find it valuable if you are not an Android dev. This book provides all the details to understand how the Compose compiler & runtime work, and how to create a client library using them. This book explores the guts of Jetpack Compose, the brand new library by Google and the Android team that will become the future of Android UI. Dedicating time now to learn about its internals in-depth will yield powerful skills to write modern and efficient Android apps in the future. If you are interested in other use cases of Jetpack Compose rather than Android, this book has got you covered also. Jetpack Compose internals is very focused on exploring the compiler and runtime from a generic perspective, making the overall experience very agnostic of the target platform. The book also provides a chapter dedicated to diverse use cases for Jetpack Compose, which exposes a few really interesting examples over code.

Author(s): Jorge Castillo; Andrei Shikov
Publisher: Leanpub
Year: 2021

Language: English

Table of Contents
Prelude
Why to read this book
What this book is not about
What this book is about
Keep the sources close
Code snippets and examples
1. Composable functions
The nature of Composable functions
Composable function properties
Calling context
Idempotent
Free of side effects
Restartable
Fast execution
Positional memoization
Similarities with suspend functions
Composable functions are colored
Composable function types
2. The Compose compiler
A Kotlin compiler plugin
Compose annotations
Registering Compiler extensions
Static analysis
Kotlin Compiler version
Static Checkers
Call checks
Type checks
Declaration checks
Diagnostic suppression
Runtime version check
Code generation
The Kotlin IR
Lowering
Inferring class stability
Enabling live literals
Compose lambda memoization
Injecting the Composer
Comparison propagation
Default parameters
Control flow group generation
Klib and decoy generation
3. The Compose runtime
The slot table and the list of changes
The slot table in depth
The list of changes
The Composer
Feeding the Composer
Modeling the Changes
Optimizing when to write
Writing and reading groups
Remembering values
Recompose scopes
SideEffects in the Composer
Storing CompositionLocals
Storing source information
Linking Compositions via CompositionContext
Accessing the current State snapshot
Navigating the nodes
Keeping reader and writer in sync
Applying the changes
Performance when building the node tree
How changes are applied
Attaching and drawing the nodes
Composition
Creating a Composition
The initial Composition process
Applying changes after initial Composition
Additional information about the Composition
The Recomposer
Spawning the Recomposer
Recomposition process
Concurrent recomposition
Recomposer states
4. Compose UI
5. State snapshot system
6. Smart Recomposition
7. Effects and effect handlers
Introducing side effects
Side effects in Compose
What we need
Effect Handlers
Non suspended effects
Suspended effects
Third party library adapters
8. The Composable lifecycle
9. Advanced Compose Runtime use cases
Compose runtime vs Compose UI
Composition of vector graphics
Building vector image tree
Integrating vector composition into Compose UI
Managing DOM with Compose
Standalone composition in the browser
Conclusion