i regularly see swift (or objc) code in mpp project but based on my understanding kotlin has direct access to android and ios platform api and anything that can be achieved with swift can be implemented w/ kotlin. am i missing something or do people just use swift because they have expertise and legacy code?
n
nestserau
01/04/2019, 3:21 PM
You’re correct.
j
Jonas Bark
01/04/2019, 3:27 PM
nah, that's a bit too simple
being able to use Swift to handle platform frameworks was a huge step towards developer friendlyness - the syntax is a lot easier and discoverable
with Kotlin Native you're back to the 'old' Objective C syntax ages (only regarding platform frameworks)
s
Sam
01/04/2019, 8:16 PM
You can have a pure Kotlin iOS app but Xcode won’t integrate with it so you’ll need to do a fair amount of manual steps in the building and packaging of an app. It’s just easier to do the UI in Swift and take advantage of Interface Builder. And when you go to package the app its just a few button clicks versus invoking a bunch of command line tools.
o
olonho
01/05/2019, 9:18 AM
not sure what Jonas means under ‘old Objective-C syntax’, syntax for Kotlin code is Kotlin, of course, and exported reverse interop stubs representing Kotlin interfaces to Swift/Objective-C compiler are Swift-friendly, so using those from Swift is pretty much as easy, as using another Swift library
j
Jonas Bark
01/05/2019, 9:42 AM
Yeah, that was spoken a bit too simple. What I mean is within Kotlin you can't use Swift-like class usage like e.g.
DispatchQueue.main.async { ... }
but instead use the less idiomatic
dispatch_async(dispatch_get_main_queue()) {...}
This isn't a deal breaker but I think it's worth mentioning