You can use the immediate recomposer on every plat...
# squarelibraries
j
You can use the immediate recomposer on every platform, and it is available to common code. On iOS/tvOS/macOS we are adding a FrameClock powered by the DisplayLink here: https://github.com/cashapp/molecule/pull/170. It's blocked on me figuring out how the hell to unit test it. I think we have a JS frame clock somewhere that uses animation callbacks to determine frames. We can probably steal the Desktop Compose UI one to get an AWT FrameClock for desktop JVM. The problem with those latter three is that you still have to set them up inside your coroutine context on each platform individually because they're all platform specific. Once you have that context, though, you can move back into fully-common code for the actual composable functions.
👍 3
k
Jake would it be considered poor form to try and track down someone from jetbrains who knows about iOS simulator unit tests and ask them directly? My post in #kotlin-native got no traction. Otherwise I could consider asking in #multiplatform
j
I am making steady progress
Hopefully Monday or Tuesday I can figure out the final thing and get it merged.
k
I'll be interested to see the end result. Thanks for bringing this over the finish line
j
We can always fall back to a full xcode project that depends on the library, but it'd be nice to avoid!
k
Yeah agreed.
x
thanks 👍 So for now we are stuck with
Immediate
, but in the future we can use the
ContextClock
together with some form of
app.cash.molecule.AwtUiDispatcher
and whatever apple one end up being called?
j
what platforms are you running on?
x
desktop, ios and js
k
Redwood has the js frame clock if you want to copypasta that
j
That one is time based because we're running it in a headless JS engine
k
Oof lol nvm
j
At one point we had a UI-based one
Jesse moved the time-based one from JS to run on the host
I'll make sure we get this and an AWT one for desktop in Molecule along with the darwin ones in the above PR.
🙂 1
k
I can do some research on what potential frame callbacks exist on linux.
j
i would expect Windows to have one. I wouldn't expect Linux to have anything and us having to provide options for Wayland and X11, if we should even bother.
i'm in no hurry if no one wants them
j
I’ve got the bridges to integrate a proper one in Redwood
e
Did we ever get to add the JVM frame clock? I dont see one anywhere 👀
j
Nope
No Swing or AWT
e
Okay thanks! I thought I was bugging. Wanted to do
Copy code
expect val MoleculeContext: CoroutineContext
but I’ll stick with
Immediate
for now
j
Feel free to PR a time based one in common
👍🏾 1