Hi everyone! :wave: Excited to share `compose-web...
# feed
p
Hi everyone! 👋 Excited to share `compose-webview`: A feature-rich WebView wrapper for Compose Multiplatform! 🚀 It supports Android, iOS, Desktop & Web with a seamless, type-safe JS Bridge that works identically on both Android and iOS. Built with Kotlin 2.2.0 & CMP 1.9.3. Feedback welcome! https://github.com/parkwoocheol/compose-webview
a
p
My library has a slightly different focus, primarily targeting Mobile productivity 1. Mobile-First & Advanced JSBridge: I focused heavily on making the interaction between Kotlin and JavaScript as seamless as possible on Android & iOS. ◦ Promise-based JSBridge: Enables using
await
in JavaScript to call Native functions and get results directly, avoiding callback hell. ◦ Flexible Serialization: Supports Kotlinx Serialization out-of-the-box, while the
BridgeSerializer
interface allows plugging in Gson, Moshi, or any other JSON library. ◦ Type Safety: Allows passing complex data objects with full type safety. 2. Platform Support Status: For battle-tested Desktop or Web support, `KevinnZou`'s library is the better choice. My library's Desktop and Web support is currently Experimental (WIP). I am actively working to improve them, but for now, they are not as feature-rich as the mobile targets. This library is designed for Mobile-heavy projects requiring a powerful, flexible JSBridge. For stable Desktop and Web requirements, `KevinnZou`'s library is highly recommended.
a
I see. Still it would be better to write it in the README.
p
Thanks for the feedback! I totally agree. I've updated the README to explicitly clarify that my library focuses on Mobile productivity with advanced JSBridge features (Promise-based, Type-safe). I also added a comparison section recommending KevinnZou's library for stable Desktop/Web needs, while clarifying that my library's Desktop/Web support is currently in a WIP state to manage user expectations. I appreciate your guidance!
👍 3
s
I feel that using KCEF or JavaFX is pretty heavy weight. For Desktop using Edge WebView2 on Windows and WebKit on macOS would be preferable.
a
@Stefan Oltmann Based on my experience with WebKit, I do not agree. It is bugged as hell. JavaFX is a thin wrapper on WebKit and the quality is not sufficient. I do not have experience with Edge WebView, but I do not think that it makes sense on saving few megabytes on download since you need to download proper binaries anyway.
I just checked and it seems like WebView2 does not have stable JVM wrapper and in fact is much larger than JCEF/KCEF. And Edge is chromium-based, so it does not make any sense.
m
@altavir What exact library combination would you currently recommend for a desktop application based on a bundled jbrsdk_jcef-25-*?
s
@altavir It's not a "few megabytes". Bundling a full Chrome Engine in JCEF/KCEF is 100+ MB. That makes so no sense and increases the installation size significant. Every Windows comes with Edge2 pre-installed now.
At my previous job I worked on a CMP WebView lib with minimal Edge WebView2 & WebKit wrappers (written by my ex-boss in C/C++), which were less than 100 KB in size. Unfortunately the project is not open source yet, but they'll release it soon (I hope). Then you'll see that for a WebView on Windows & macOS you only need to add 100 KB to your app in total.
I finished working on that lib two months ago, but my boss wanted to battle test it first in a production app, so it's not released yet.
u
@Stefan Oltmann How does it perform as an item inside LazyColumn? I had trouble embedding X and Spotify iframe elements and state management but could not create a solution
s
Good question - I don't know. We didn't put it there, only in a normal Column (with elements above and below). Unfortunately I no longer work for them and so I don't have access to it anymore. Therefore I can't test it right now. I'd assume that it works fine. You'll see when the lib is released.
m
I have to admit that I heard of MS Edge WebView2 for the first time here but from what I have read now it seems to make a lot of sense even if it might not be perfect yet. @Stefan Oltmann Please keep us posted about the progress of that CMP WebView lib. (And you probably meant "That makes no sense ..." in your comment above. 🧐😉)
s
@Michael Paus It worked very well for the products of my former employer, the Software Rangers. Everything is ready. My ex boss just needs to press the button to publish it. I spoke with him this morning and he said he will do that soon. It will also be his first post and his introduction to this community.
👍 2
m
Do you know which WebView the lib uses on Linux?
s
It's implemented for Windows & macOS (on Desktop) only, but @אליהו הדס offered to contribute a Linux implementation once it's released.
The software I worked on in the past years has no Linux support, because it's commercialy not relevant - according to my former boss.
The lib of course also supports iOS & Android. That's implemented like everywhere else. Making a WebView lib just for mobile is a rather simple task. Desktop is the challenge.
👌 1
We tested every other lib available, which are usually based on JavaFX and KCEF, but we did not like either having to include JavaFX or a Chrome engine, which are both pretty big packages.
👌 1
My former boss is good at C/C++ native stuff, so he wrote that native part and JNA bindings. I made the CMP part. It's a pretty decent lib and I hope he really releases it soon.
I got fired last month, so unfortunately I have no influence about that anymore.
😢 3
I wanted to release it two months ago, but he wanted to battle test it first in a production app. And indeed there were some improvements after the first draft. I think it's fine now for a release. He just needs to take the time and put it up.
236 Views