https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
k

kpgalligan

10/26/2019, 4:20 PM
Giving a talk on Multiplatform library development. Looking for thoughts on what libraries/tools developers think are critical and missing. Just comments in a thread for now I guess (or DM).
Current list: date/time, mocking, “server client” (graphql, swagger codegen). Multithreaded coroutines, of course.
UI stuff too I guess, but I’m probably just avoiding that altogether for this talk.
c

Casey Brooks

10/26/2019, 4:25 PM
My biggest wish is that multiplatform tooling would work out-of-the-box with all the features needed for both dev and production builds, for both libraries and apps, without needing to do any custom Gradle tasks or platform-specific configurations. I want to just work purely in Gradle with the options on the standard tasks, and not have to think about what is being used under-the-hood.
3
i

ian.shaun.thomas

10/26/2019, 4:28 PM
same as date/time but more core, lack of locale support is rough
k

kpgalligan

10/26/2019, 4:34 PM
@Casey Brooks Kind of a different discussion, but do you want clear config or you don’t want to have to do any of it? I can’t imagine being able to output a native binary without needing to give it some info. The Android gradle build being a mature example that requires a lot of platform specific config out of the box. Not saying the native config for KMP can’t be simpler, but there’s probably a minimum
@ian.shaun.thomas Yeah, locale support. Good one.
d

Dominaezzz

10/26/2019, 4:36 PM
file io
👆 3
k

kpgalligan

10/26/2019, 4:36 PM
Ah, right. That too.
i

ian.shaun.thomas

10/26/2019, 4:38 PM
has code generation been formalized or is that still a "you probably shouldn't try it" feature? I know serialization uses it but I would really like an MPP version of retrofit that naturally plugs in with ktor
f

Fudge

10/26/2019, 4:39 PM
Compiler plugins are currently very experimental. However, Jetpack Compose is also powered by a compiler plugin, and the Arrow guys are working on a library to make plugin development easier, as well as a few of their own compilers plugins.
k

kpgalligan

10/26/2019, 4:39 PM
Ah, yes. Code gen. I think the “formal” version of that is waiting on the GCRW (grand compiler rewrite). Last time I looked, which was quite a while ago, you needed to add a hook into the native compiler to make a plugin available
Ah, updated info as I type
I’d like to know a lot more about that. I saw something about that and arrow, but was low on context.
for more info go to #arrow-meta
k

kpgalligan

10/26/2019, 4:43 PM
Damn. Pushed onto the todo stack. A lot going on there. Need to finish this talk…
r

russhwolf

10/26/2019, 6:13 PM
re graphql, this exists but I haven’t looked at it beyond the readme https://github.com/yshrsmz/kgql
In terms of missing tooling, I’d love to see more stuff that makes it easy to spin up new projects without needing a lot of manual configuration. eg the xcode-compat gradle plugin that AppCode uses (https://github.com/Kotlin/xcode-compat/issues) can build a new xcode project for you, but it’s not very configurable. I learned about a tool called xcodegen at a meetup this week (https://github.com/yonaskolb/XcodeGen) which is a cli for generating xcode projects. At some point I want to explore using it for creating multiplatform project templates.
k

kpgalligan

10/26/2019, 6:37 PM
That stuff always kind of freaks me out. It needs to be super well supported or it gets old quick. Especially with Xcode, as Apple is more than happy to break what the community has out there (our kotlin plugin needed a whole bunch of changes for Xcode 11)
For multiplatform, keeping up with the changes are tough. I still haven’t updated to kts from groovy.
💯 1
I’m thinking about publishing a template project to go along with the talk, but unless you commit to updating that for future releases that becomes yet another old and confusing thing sitting out on the interweb.
The intellij templates need more work, though. It’s actually pretty difficult to use one of them and get a useful project out of it. More often I’ll just copy/paste an existing project and update manually.
r

russhwolf

10/26/2019, 6:56 PM
yeah i do similar. But good point on xcode breakages. Maybe it’s not a solvable problem given the tooling instability.
Doing the kts switch is nice though. Makes it a lot easier to figure out custom gradle stuff even if the syntax gets clunkier
k

kpgalligan

10/26/2019, 7:00 PM
This is a common issue and not strictly associated with KMP, Xcode, etc. Config feels like a lot of busywork that you can abstract out, but between the version changes and breadth of config options, there may simply be unavoidable “paperwork” associated with project config.
You can make a tool around it, but then you need to update it, and that’s a commitment.
For example, one of the things that regularly gets discussed with our team internally is creating a project template that includes all the stuff we’d use for a new project. I generally try to shoot this idea down.
Every project needs different things, and different libraries and versions happen all the time. You’d spend way more time maintaining the template than on the time you’d save by using it.
If 1000 people used your template regularly, maybe there’s aggregate value, but that’s a tough sell. For example, the xcode gen thing. I’m sure there are situations where that’s useful for automated builds, but for my projects, Xcode itself is pretty easy for creating new projects.
In Xcode 11, they added a choice of UIKit or SwiftUI. That was cool. If you’re maintaining the cli tool, Xcode 11 added a bunch of stuff you may/may not want to add.
Anyway, this is me procrastinating instead of working on talk…
😀 1
l

louiscad

10/26/2019, 7:13 PM
SnapKit in Kotlin/Native for iOS and co. would be cool.
k

kpgalligan

10/26/2019, 8:38 PM
@louiscad just a wrapper for iOS/macos only, or something that can be multiplatform?
UI is going to be a tough road for a bit I think. Compose and SwiftUI will take a lot of the attention, even if something in the near term would make sense.
f

Fudge

10/26/2019, 8:47 PM
Copy code
box.snp.makeConstraints { (make) -> Void in
           make.width.height.equalTo(50)
           make.center.equalTo(self.view)
        }
Hmm, this doesn't look very nice...
l

louiscad

10/26/2019, 8:51 PM
@kpgalligan Something for Apple's OSes only. That would enable people to make higher level common APIs based on it. Would be easier for me since I don't use xml on Android, but homemade #splitties Views DSL which supports ConstraintLayout well. Last time I tried using UIKit constraints vanilla didn't work out well.
a

alex009

10/27/2019, 5:32 AM
https://kotlinlang.slack.com/archives/C3PQML5NU/p1572115178209300?thread_ts=1572106811.204000&channel=C3PQML5NU&message_ts=1572115178.209300 @kpgalligan check https://github.com/icerockdev/moko-template - here already done configs for mobile development and defined many mpp dependencies (in buildSrc definifions)
👍 2
t

thevery

10/28/2019, 8:17 AM
I miss retrofit and non-coroutines any-thread http client
m

Marc Reichelt

10/28/2019, 8:20 AM
Some things I think would help much with multiplatform development: - lots of examples, like: - how to setup a greenfield iOS/Android project - how to add KMP to existing iOS/Android apps - how to create a KMP library supporting various platforms - how to test multiplatform code, and especially, how to test that it also compiles/runs on iOS (Mac CI server? yay…) - how to setup a Git containing iOS/Android - how to setup CI/CD for all those things - what should we do if not everyone in the teams have a Mac? Because those that don’t have one can’t compile iOS stuff on their machines… - some FAQ - where to get help when things go wrong (e.g. StackOverflow, this Slack) - showcases: who’s using it? This is something we need to grow together!
best practices around iOS development, like: - how to write APIs that make iOS developers happy (i.e. network calls) - how to handle shared code (one central Git? Deploy as CocoaPod in a private repo? Build shared code locally?) - how to debug in case of bugs / exceptions / etc.
m

martin.petrulak

10/29/2019, 9:32 AM
what i find as the biggest pain point at the moment is tooling and the fact that when you bump some dependency you might break everything adn fixing might take some time (as i am fixing something right now)
l

louiscad

10/29/2019, 1:31 PM
@martin.petrulak Would you use a third-party plugin that checks for ability to update the Kotlin/Native version taking into account all the dependencies you have?
m

martin.petrulak

10/29/2019, 1:33 PM
@louiscad i would use enything that would simplify my life 🙂 in this case i would use the plugin for sure
l

louiscad

10/29/2019, 1:54 PM
Alright @martin.petrulak, I'll see if we can integrate that in #gradle-refresh-versions at some point.
m

martin.petrulak

10/29/2019, 1:57 PM
@louiscad you make it work, i buy you a beer keg :)
😅 1
k

kpgalligan

10/29/2019, 2:38 PM
Might want to look at Intellij’s new library search plugin. May have a version validator
5 Views