https://kotlinlang.org logo
#compose
Title
# compose
s

Sergey Y.

03/04/2021, 11:36 PM
How do I enable the new `experimental multithreaded recomposition`(yes, I am aware of the problems)? Leland said on the stream that it is now possible and you can turn it on and play. I'm reading the source for the
CompositionContext
class, but I don't know how to use it. Can anyone please help? Thanks 🙂
d

Dominaezzz

03/04/2021, 11:40 PM
On
Composition
or
Recomposer
there's a method called runConcurrent....something I think.
s

Sergey Y.

03/04/2021, 11:42 PM
nothing there similar 😞
I definitely know Adam Powell worked on this, but I don't want to mention him for trifles. 😬
👀 1
Recomposer.runRecomposeConcurrentlyAndApplyChanges
is what it's called lol.
s

Sergey Y.

03/04/2021, 11:52 PM
How should I use it?
I thought it would be something like a compiler flag
d

Dominaezzz

03/05/2021, 12:03 AM
No idea. Maybe source code of
setContent
might have a hint.
a

Adam Powell

03/05/2021, 12:27 AM
1. make a Recomposer (probably with
AndroidUiDispatcher.Main
as its effect context) 2. get it running by calling the method described above, use
AndroidUiDispatcher.Main
for that call (edit: launch the call into
AndroidUiDispatcher.Main
and pass some background dispatcher like
Dispatchers.Default
or a background single-threaded dispatcher as the recompose context parameter) 3. create a ComposeView and set its parentCompositionContext to the Recomposer you created 4. Attach your ComposeView to a window
❤️ 1
🎉 3
you'll probably run into some bugs right away 🙂
k

Klaas Kabini

03/05/2021, 8:24 AM
🤣🤣🤣🤣🤣
2
19 Views