Re:Kotlin 1.2 Released: Sharing Code Between Platforms
by yole on Tuesday November 28, 2017 @12:40PM
(#15799441)
You can do isomorphic (server-side and client-side) rendering in Kotlin. For mobile UI, you can build native UIs in Kotlin for Android and for iOS, but the UI code will be different for each platform, built on the native API of the corresponding platform. At this time we have no plans to build a solution for reusing UI code between mobile platforms.
Re:Kotlin 1.2 Released: Sharing Code Between Platforms
by continuations on Tuesday November 28, 2017 @12:58PM
(#15799625)
If I can't reuse code between iOS & Android then what is the benefit of using Kotlin over just building mobile apps in Java & Swift?
Re:Kotlin 1.2 Released: Sharing Code Between Platforms
by Benjammer on Tuesday November 28, 2017 @04:00PM
(#15801559)
IMO, It's just a different approach to the idea than the React world. I would assume the idea here is that you always want to write your UI layer "natively" in order to take full advantage of platform-specific performance accelerations/hardware APIs, but the entire stack underneath what's actually rendering visual components would be shared.
It forces you to start out more modular between your UI code and domain logic code, whereas React (& React Native) leaves the door open right at the start for tight coupling between UI code & domain logic, unless you expressly build this separation into your initial architecture.
Re:Kotlin 1.2 Released: Sharing Code Between Platforms
by s73ver_ on Tuesday November 28, 2017 @03:26PM
(#15801141)
They said UI code. You shouldn't be reusing that anyway. You should be writing stuff to take advantage of the native platform.
Re:Kotlin 1.2 Released: Sharing Code Between Platforms
by yole on Tuesday November 28, 2017 @01:00PM
(#15799656)
You can't reuse UI code between iOS and Android. You do have the ability to reuse the business logic code (domain models and so on).
Re:Kotlin 1.2 Released: Sharing Code Between Platforms
by maxdo on Tuesday November 28, 2017 @01:48PM
(#15800133)
Great idea , but for many react apps (both native and JS) domain models doesn’t exists. Redux + graphql apps let me eliminate even more logic. So what we actually share between react native and react JS apps are : graphql queries, reducers, saga middleware. The rest is just UI. In my usecases there is nothing to share using Kotlin.
Re:Kotlin 1.2 Released: Sharing Code Between Platforms
by just-boris on Wednesday November 29, 2017 @04:36AM
(#15805678)
Why do you compare Kotlin against React? They can work together: https://blog.jetbrains.com/kotlin/2017/04/use-kotlin-with-np...
Write your React code in Kotlin, compile to JS and use it everywhere where React is supported.
- server side render a page to HTML and send it to browser, or
- send down the React code as JS and render in browser, or
- use React Native to write sorta native Android/iOS apps and reuse some of my JS codebase
Does Kotlin cover the same use cases of server-side render & browser render & native mobile apps?