https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
multiplatform
  • b

    bod

    01/09/2021, 7:50 PM
    Hello, World! Is it possible to use the debugger in the native version of an app inside IntelliJ? (I mean the Community version)
    b
    • 2
    • 5
  • r

    Reed Ellsworth

    01/09/2021, 10:28 PM
    I have 2 multiplatform libraries where library A uses code from Library B (logging). When I add a dependency in library A's build.gradle.kts in the normal fashion:
    dependencies {
        api(project(":logging"))
    }
    The library B (logging) code is not available to be used inside code in Library A. I have seen someone say that I have to publish Library B to a local maven repository but that is a pain to do especially when both libraries are under heavy development. I am using 1.4.21 kotlin multiplatform plugin. Has anybody gotten this to work?
    s
    l
    • 3
    • 3
  • p

    Philip Dukhov

    01/10/2021, 4:49 AM
    I have two modules. first one added to both iOS and Android, and second one is added to the first one as a dependency. iOS headers for classes from the second module are generated only if the class is needed for headers of the first module. Let’s say I have a class B in the second module. if I create any public variable of type B in any class of the first module, I can use class B in swift. And extension functions are not included at all. Is there a way to mark a subproject class/extension as needed to be included to the framework headers?
    m
    • 2
    • 1
  • i

    Ivy

    01/10/2021, 4:03 PM
    Hello, How do you manage String resources in Kotlin Multiplatform Mobile(Android & iOS)? I found this post(https://chrynan.codes/string-resources-in-kotlin-multiplatform/), but I wonder what the best practice is.
    m
    e
    a
    • 4
    • 8
  • c

    chi

    01/11/2021, 2:55 PM
    Where can I find reliable information on importing/integrating an existing production iOS project with an Android KMP? It'll be great if the KMM Android studio plugin could do this easily
    ➕ 3
    z
    • 2
    • 1
  • w

    william

    01/11/2021, 4:57 PM
    is there anyway to access the SwiftUI framework from multiplatform code? i want my iOS viewmodel to extend
    ObservableObject
    but it seems like I may not be able to access SwiftUI since there are no obj-c bridging headers edit: change compose to swiftui - too much android on my mind
    t
    d
    m
    • 4
    • 5
  • j

    Jack Darlington

    01/11/2021, 5:25 PM
    Hi, I wondered if anyone could help me out with Kotlin Multiplatform: I have a multiplatform module that has common / android and ios implementations, with 1 pod dependency. I can build this successfully, and produce a POD. I then have a second multiplatform module that depends on the first one above. In gradle I can build with compile..IosX64KLibrary, and it generates fine. However, when I try and build iOS app, it complains saying "_Module not found_", for the pod dependency in the second module. It fails on the cinterop task of the dependency module after calling (parent module).syncFramework from the kotlin build function. Is there any workaround for this error. Basically, I just want the kotlin multiplatform library, then implementation project(":childModule") in another multiplatform module, and be able to build the iOS app with a dependency just on the parent, and for it to pull in the child explictlly / just build it into the first one Hope that makes sense, and can provide more information if needed! Thanks
    m
    • 2
    • 3
  • h

    Hamza GATTAL

    01/11/2021, 8:51 PM
    Kotlin Multiplatform in Alpha stability Is there a fixed date to launch the stable realise or roadmap for this feature
    l
    • 2
    • 1
  • j

    Jack Darlington

    01/12/2021, 12:47 PM
    Is there a way to create a an expected class that could be either a class or an abstract class in different platforms For example,
    expect abstract class Thing {
    }
    actual class Thing {
    }
    actual abstract class Thing {
    }
    Obviously the example above doesn't make sense, but it does if you are trying to typealias to already existing code. It is not a huge issue, but just wondered if it existed already
    s
    j
    k
    • 4
    • 7
  • i

    Ivy

    01/12/2021, 1:06 PM
    Hello, I’d like to hear your feedback on which is a better way to develop a mobile cross-platform. It’s been more than 3 years since I developed the Android app, but it’s my first time developing a cross-platform. So I wonder if the Kotlin Multiplatform Mobile(KMM) is more effective than React Native or Flutter. KMM needs to write the UI code for each platform, but is KMM a more effective way? What do you think of that? If you know a good post about that, please share the link. Thanks in advance. 😄
    y
    d
    +5
    • 8
    • 23
  • b

    Boris Dudelsack

    01/12/2021, 6:53 PM
    Can someone please explain me why i can use
    runBlocking
    in
    linuxMain
    and in
    macosMain
    but i cannot use it wether in my own source set
    nativeMain
    nor in
    commonMain
    . Do i need add some sort of configuration to the source set?
    plugins {
        kotlin("multiplatform")
    }
    
    kotlin {
        linuxX64("linux") {
            binaries {
                executable()
            }
        }
    
        macosX64("macos") {
            binaries {
                executable()
            }
        }
    
        sourceSets {
            val commonMain by getting {
                dependencies {
                    implementation(kotlin("stdlib-common"))
    
                    implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1-native-mt")
                }
            }
    
            val nativeMain by creating {
                dependsOn(commonMain)
            }
    
            val macosMain by getting {
                dependsOn(nativeMain)
            }
    
            val linuxMain by getting {
                dependsOn(nativeMain)
            }
    
        }
    }
    s
    m
    +4
    • 7
    • 16
  • k

    Kris Wong

    01/12/2021, 9:03 PM
    we have discovered that if we run pod install using a podspec created by the cocoapods plugin, and the framework has not been built yet (which is the normal workflow when first cloning the repo), that cocoapods does not do the right thing. pod install must be run after the framework is created. has anyone else run into this?
    t
    • 2
    • 3
  • p

    Philip Dukhov

    01/13/2021, 1:17 AM
    I need to convert
    Int
    to
    ByteArray
    .
    .toByte()
    gives only first 8 bits, but I need a whole number.
    usePinned
    looks like what I need, but it’s unreachable in the commonMain
    👀 1
    t
    • 2
    • 2
  • n

    n8ebel

    01/13/2021, 2:44 AM
    We’re working on setting up a multiplatform project in a new repo The plan is to publish iOS and JVM artifacts to then consume in each of our apps Currently, our very simply project is setup like this
    moduleA
    - one unique feature
    moduleB
    - another unique feature we then have
    moduleC
    setup to pull in the other modules and create a single iOS framework for us to version/publish I’m wondering though what would be the best way to publish/consume the JVM artifacts? At the moment, we get a JAR for each module, which we could give a unified version and publish separately. But I’m wondering if we might be better off having a single JAR for all modules like with the iOS framework 1. Is that a reasonable idea? Anyone try that and run into problems? 2. Is that something that can be setup “out of the box” or would we need to create a custom task to unzip jars and rezip into a new, unified jar?
    👀 1
    y
    • 2
    • 1
  • l

    Lefko

    01/13/2021, 11:05 AM
    I have been trying to push a limited experiment of KMM in my company and I'm getting some pushback from iOS team that KMM uses objective-C under the hood which has limited support of generics. Is this true? If not where can I find documentation...
    m
    y
    • 3
    • 3
  • t

    tylerwilson

    01/13/2021, 2:10 PM
    I get this tooltip, no idea how to ‘enable it explicitly’. any ideas?
    j
    m
    • 3
    • 15
  • n

    nrobi

    01/13/2021, 3:28 PM
    We've just published one of our internal KMP playground projects, some of the key points being: • A shared ViewModel layer • Declarative UI (Compose & SwiftUI) • Image upload • Shared localization (with moko-resources, thanks to @alex009 & the IceRock team) • multiple KMP modules • Android & iOS targets (with macOS coming soon, desktop & web planned) Big thanks to @John O'Reilly & the Touchlab team, since some of the setup is based on either PeopleInSpace, BikeShare or KaMPKit You can find the repository here
    ❤️ 1
    :kotlin-intensifies: 11
    👍 20
    :kotlin: 6
    👏 6
    a
    l
    +2
    • 5
    • 23
  • a

    Amritansh

    01/13/2021, 3:36 PM
    My Kotlin multiplatform library does not work with build variants which are using proguard. There is no compile time error but library functions just don't work at runtime. For variants which are not using proguard, the library is working fine. Anyone else faced something similar or have a solution to this issue?
    j
    k
    • 3
    • 3
  • j

    Jack Darlington

    01/13/2021, 4:52 PM
    Another question 🙂. If i am using a library that from swift returns an array of Any. Does this automatically get converted to an array of strings in kotlin? That is what I am finding. The library I am using seems to run JSONSerialization from the swift code, so I have a callback that I use to access that. The kotlin code converts it to a lambda that returns a Array<*>, but when i access the first value, instead of it being of a dictionary, it is of a string (as far as I can see it seems to be a string representation of a dictionary). Cheers
    • 1
    • 1
  • m

    Marcus

    01/14/2021, 12:00 PM
    To build upon https://kotlinlang.slack.com/archives/C3PQML5NU/p1610531551245000, digging around brought me the clue that I might want to try to set
    -fmodules
    for the
    compilerOpts
    . However, I can find no documentation on how to do this for a Cocoapod. Any suggestions?
    a
    k
    • 3
    • 9
  • n

    nrobi

    01/15/2021, 7:56 AM
    Anyone tried to use
    Ktor
    and/or
    SqlDelight
    ’s native dependencies in an intermediate source set?
    • 1
    • 2
  • a

    Arkadii Ivanov

    01/15/2021, 5:30 PM
    Given I have an
    expect object
    with inner interface inside it, how can I use this interface in an
    actual
    implementation?
    expect object MyObject {
        fun foo(): MyInterface
        
        interface MyInterface {
            fun bar()
        }
    }
    
    actual object MyObject {
        actual fun foo(): MyObject.MyInterface = // MyInterface is unresolved here 
            TODO()
    }
    a
    • 2
    • 2
  • d

    darkmoon_uk

    01/16/2021, 12:52 AM
    Q: Is anyone successfully running a KMP build pipeline that includes coroutine-based unit tests, running on iOS simulator? I have an idea of the work involved to achieve this; but a more immediate challenge is the Dev team, a couple of whom are casting doubt on the entire KMP tech choice. Testability could be the deal breaker, so hearing of success stories could make a difference... Would be a shame to come this close, only to be forced to drop KMP... Or are they right and this area of the toolchain just unworkable for production right now? Experiences?
    k
    • 2
    • 2
  • s

    spierce7

    01/17/2021, 5:14 AM
    What’s the best multiplatform logging solution that people are using? One of the things I always enjoyed about
    Timber
    is that you could swap out the actual logging implementation so that you could route all logs into something like Crashlytics.
    a
    j
    +4
    • 7
    • 11
  • m

    Michal Klimczak

    01/17/2021, 8:12 PM
    What is the state-of-the-art solution for concurrency when exposing KMM to iOS? I was thinking coroutines native-mt + some wrapper which can be transformed to Swift Combine but I'm not seeing a lot of this on github tbh and there's some boilerplate to glue it all together.
    j
    j
    +3
    • 6
    • 25
  • m

    Matteo Wohlrapp

    01/18/2021, 8:47 AM
    Does anyone know if I am missing anything or has another explanation why it won’t work?
    n
    m
    • 3
    • 7
  • m

    Michal Klimczak

    01/18/2021, 11:31 AM
    I cannot get around Unresolved reference (might be related to the issue above, but probably not). in a multimodule project. 1. I have
    ioswrapper
    module which is multiplatform
    plugins {
        kotlin("multiplatform")
        id("java-library")
    }
    2. And then I have a
    ioswrapper-processor
    which depends on
    ioswrapper
    but is pure jvm (because it's an annotation processor based on kotlinpoet).
    plugins {
        kotlin("jvm")
        id("java-library")
    }
    dependencies {
        //... kotlinpoet etc
        implementation(project(":ioswrapper"))
    
    }
    In Android Studio
    ioswrapper-processor
    classes show lots of
    Unresolved references...
    even though everything builds just fine. This didn't occur when
    ioswrapper
    was a simple jvm module. Any fixes or workarounds?
    n
    • 2
    • 2
  • n

    Nadjib

    01/18/2021, 2:14 PM
    When I set my Xcode debug format to DWARF with dSYM files, I get thousands of warnings of this type:
    warning: (x86_64) could not find object file symbol for symbol _kfun:kotlinx.atomicfu#atomicArrayOfNulls(<http://kotlin.Int|kotlin.Int>){0§<kotlin.Any?>}kotlinx.atomicfu.AtomicArray<0:0?>
    Does anyone faced this issue before when using kotlin multiplatform on IOS?
    ➕ 2
    m
    d
    a
    • 4
    • 7
  • s

    Sebastian Kaspari

    01/19/2021, 12:16 PM
    I wonder what the best setup is if you have an independent iOS app that should consume a multiplatform library from maven. Would you create some kind of small shell kmm setup locally to consume the maven dependency and build a local framework to consume from the iOS app? Or are there other, more iOS idiomatic ways of doing that (which do not require a full gradle build setup locally)?
    💯 1
    m
    p
    j
    • 4
    • 7
  • a

    Alex Anisimov

    01/19/2021, 1:36 PM
    The results of the first Kotlin Multiplatform survey are out! Learn how developers from all around the world are sharing code between platforms and enjoying the multiplatform capabilities of Kotlin. https://blog.jetbrains.com/kotlin/2021/01/results-of-the-first-kotlin-multiplatform-survey/
    👍 15
    z
    • 2
    • 1
Powered by Linen
Title
a

Alex Anisimov

01/19/2021, 1:36 PM
The results of the first Kotlin Multiplatform survey are out! Learn how developers from all around the world are sharing code between platforms and enjoying the multiplatform capabilities of Kotlin. https://blog.jetbrains.com/kotlin/2021/01/results-of-the-first-kotlin-multiplatform-survey/
👍 15
z

zalewski.se

01/19/2021, 10:03 PM
Is it just me or link to the roadmap is broken?
View count: 16