https://kotlinlang.org logo
Title
a

Ahmed na

04/30/2023, 5:48 PM
Hi Would like to share with you an open source project we’ve been working on since last year involving kotlin Multiplatform TL;DR Would love to get a feedback and maybe help from community with this multiplatform-libraries structure, or even merge into something bigger At AirAsia we have an 11 years old super app , we do bookings for flights, hotels, taxi, activities, entertaining, chat …etc and so many other features, And we were desperate for a shared logic approach to cutdown on development time, also we wanted a native approach (we already integrated react native to some parts of the app) . We could not start from scratch with KMM project and wanted to support web and involve our backend services as well (shared models), So we looked into multiplatform-libraries , after breaking down our modules we figured we might reach up to 40 libraries, So we needed a scalable structure that we can maintain, also we needed a project starter ! so we ended up building kmp.telereso.io it provides the following • Project starterEach project outputs 2 libs ◦ Models - data classes (pojos) that can be shared with backend ◦ Lib - business logic • 6 platform support , Android , iOS , Browser , backed (JVM,NodeJS) and ReactNative support ! (Currently Working on flutter ) • Core lib that supports ◦ Task (Multithread) - handle some of limitations on some platforms ◦ CommonFlow - flow wrapper for android , iOS and JS ◦ Logging • Annotations ◦ Json Converters Builder ◦ ListWrapper (solve nested generic type introp in iOS), also List support for JS (generate array equivalent ) ◦ ReactNative - auto generate a react native module by bridging into the android and iOS libs ("ReactNative interpolator") • Gradle Plugin There are more features can check at kmp.telereso.io and docs We've finished 6 sdks so far some of them rolled out to prod, we will continue building both core and kmp-annotations to smooth sdk building and speed up development time
m

Matt Rea

04/30/2023, 7:21 PM
The React Native codegen is interesting. I’ve been thinking about building something like that I generally don’t recommend using React Native, but for better or worse, there’s a lot of RN projects out there. Integrating native code into React Native can be painful. This makes it a bit easier
a

Ahmed na

05/01/2023, 12:03 AM
Yes especially iOS, need to maintain 2 files and one of them is in objective-c so was a good use case for ksp to solve 🙌
a

ankushg

05/01/2023, 3:17 PM
Super cool! Any thoughts on adding a method like “@SerializeParameters” that serializes all method parameters and the return type? We end up doing this in a few places for JS because JS callers often have objects like { foo: bar } instead of class instances
a

Ahmed na

05/02/2023, 12:25 AM
@ankushg this is what
@ReactNativeExport
does , it serialize none primitive types at native side then deserlize them at JS side (for a manager class) so i think the logic is there but the output is a react native bridge, if you like describe your use case here (what was the manual logic needed and how it was used) i'll see if we can provide a new annotation !
a

ankushg

05/02/2023, 12:28 AM
Interesting, didn’t realize that! I’ll write up our use case and submit it, but it does look like a lot of the existing RN work is similar to what I’d be looking for