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
  • j

    Joey

    04/21/2020, 3:49 AM
    Hi, i am trying to use dispatcher of swift in my iosMain. It couldn't resolve some of the references
    m
    e
    • 3
    • 7
  • z

    ZabGo

    04/21/2020, 10:29 AM
    Hello, I am new to Kotlin Multiplatform. I want to make a mobile app in ios and android. I am trying to implement a third party library written in C/C++. I want to create the following function in androidMain :
    fun setContext(currentActivity: Activity){
    	connector.setUIContext(currentActivity) // this function is from the third party library
    }
    I wonder how I could access the type Activity. It looks it does not recognise it or the android api is not accessible. Do I need to add anything in the build.gradle.kts? Thanks for your help
    m
    k
    • 3
    • 6
  • d

    dimsuz

    04/21/2020, 12:54 PM
    I see that this is the question which was asked before, but what is the current best solution on sharing string resources + localization between platforms? Is there any? Does everyone use
    moko-resources
    ? Or doesn't bother and duplicates?
    m
    a
    • 3
    • 8
  • k

    kkovach

    04/21/2020, 1:03 PM
    I'm getting the following error when trying to compile my shared multiplatform code. I'm guessing it's some sort of version mismatch with something, but I cannot figure it out. Any help would be appreciated.
    • 1
    • 2
  • c

    curioustechizen

    04/21/2020, 3:38 PM
    In a multiplatform module that has
    commonMain
    and
    iosMain
    , I want to create a
    iosTest
    folder that uses iOS-specific code for writing tests to be run on the simulator. I've looked around but I think all the info I find is out-dated. What's the latest on this?
    k
    • 2
    • 14
  • j

    Jess Brent

    04/21/2020, 7:08 PM
    is there a way to prepend the
    com.whatever.whatever
    for import statements one platform, but not another? i can’t really come up with the exact phrase to google here so i’m a little SoL
    e
    g
    • 3
    • 8
  • s

    saket

    04/22/2020, 4:59 AM
    Along the same lines: now that I’m starting to develop for macOS, I’ve noticed that none neither the official guides nor the other blogs talk about the feedback loop for native development with KMP. When changes to the common module is made, they can be used immediately from JVM or Android modules. That does not seem to be the case for native platforms. I have to rebuild my macOS project from xcode everytime to see new changes. Is that expected?
    c
    • 2
    • 10
  • c

    curioustechizen

    04/22/2020, 7:57 AM
    Is there a reference documentation for understanding the implicit dependencies between source sets in KMP? For example,
    androidMain
    and
    iosMain
    implicitly depend on
    commonMain
    . How about tests? Do
    androidTest
    and
    iosTest
    implicitly depend on
    commonTest
    ? This seems intuitive, but is it documented somewhere?
    a
    k
    • 3
    • 4
  • g

    gabin

    04/22/2020, 2:48 PM
    Hi guys, does this commit mean that google wants to expand its View hierarchy on desktop with Kotlin MPP? https://android-review.googlesource.com/c/platform/frameworks/support/+/1290729
    f
    • 2
    • 1
  • j

    Jan Stoltman

    04/22/2020, 3:40 PM
    Hey guys, are there any tips and tricks on how to improve kotlin/native compilation speed? Right now my project takes around 20min to build .framework for ios and just around 3min for android. Is it a common issue for multiplatform projects or is something wrong with my setup?
    k
    j
    s
    • 4
    • 11
  • d

    dimsuz

    04/22/2020, 4:49 PM
    How can I set
    kotlinOptions.jvmTarget = "1.8"
    for android target? Without it I have an error:
    Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6
    I tried
    android("android") {
            compilations.main.kotlinOptions {
                jvmTarget = "1.8"
            }
        }
    And it doesn't work, gives a DSL error.
    k
    • 2
    • 2
  • m

    Matt Toal

    04/22/2020, 10:29 PM
    Any recommendations on how to set up multiple multiplatform projects together? I have something like projects A and B with a shared core project. My javascript output for project A has the shared code packaged with it, but my android aar for project A does not. I can publish the aar for the shared project, and have the consuming android project pull in both as a dependency, but it seems a little weird that javascript output is combined while the android isn't.
    l
    • 2
    • 1
  • r

    Rak

    04/23/2020, 3:10 PM
    Hi, I’ve been meaning to start playing with mpp for android/ios. Yesterday, i listened to a podcast (Talking Kotlin) and they seem to imply that there are still a lot of issues running the shared code on iOS. Does anyone have more data on this? Is it bad that its not production ready? Or are their work arounds I need to investigate?
    a
    k
    • 3
    • 5
  • s

    Sam Garfinkel

    04/23/2020, 4:37 PM
    What’s the best approach to making an existing JVM library (dependency-free) multiplatform compatible? I see two options, reimplement all Java in Kotlin as a common module, or implement just the API with
    expect
    in the common and delegate to the Java library on the JVM, and other similar libraries on their respective platforms (like a swift library with the same capability on Mac/iOS, etc.). Is one better than the other?
    c
    r
    k
    • 4
    • 5
  • j

    j.l.

    04/23/2020, 7:28 PM
    I was playing around with KMP building, testing some Android/iOS features. This was about a week or two ago. I noticed that whenever I am working in IntelliJ and make updates to the shared code in IntelliJ such as adding a function to a shared class, then switch over to Xcode to try and use this function, it takes a really long time for the function to show up in Xcode's autocomplete. The function is not recognized either and causes compilation errors. Sometimes it takes so long that I have to invalidate caches and restart in order for the function to show up in Xcode. Just thought I would mention this. Anyone else having issues like this? Even if I edit the shared code in Xcode, the function/variable is not recognized. Also, there is no kotlin syntax highlighting in Xcode (not sure if this is possible to acheive), that is why I use IntelliJ b/c the syntax highlighting makes life a lot easier. Using 2 IDE's is probably not the ideal way to go about things. I didn't try doing everything from Xcode. But if developing for multiplatform, eventually you will need at least 2 IDE's if you want to see the app in the emulator. At one point, I had 3 IDE's open (Android Studio, IntelliJ, Xcode) and my laptop crashed. (though I did have a ton of chrome tabs open and other programs running simultaneously). Just thought I'd share my experiences developing multiplat so far. Other than the little inconveniences that I frequently encounter, KMP has been pretty great.
    k
    t
    +2
    • 5
    • 8
  • s

    Sam Garfinkel

    04/23/2020, 11:00 PM
    Is there any idiomatic, first-class analogue for suspendible InputStreams in KMP? I guess you could probably use a flow that emits bytes or something? This library seems like the only option currently: https://github.com/Kotlin/kotlinx-io
    m
    • 2
    • 2
  • m

    mbonnin

    04/24/2020, 1:50 PM
    Is there something like japicmp for kotlin MPP ? Obsiously it will not be able to work on binaries but maybe at the source level ? Or using metadata ?
    j
    • 2
    • 3
  • s

    SooYoung

    04/25/2020, 6:13 AM
    Hello. I’m comparing Kotlin MPP to React in terms of testing. While Mockito, Robolectric, Espresso, Hamcrest and Google truth are available for use in Android world, are there any frameworks supporting similar features that can be used to test common code?
    t
    m
    j
    • 4
    • 4
  • j

    Joey

    04/26/2020, 5:37 AM
    I have the ff gradle
    plugins {
        id 'org.jetbrains.kotlin.multiplatform' version '1.3.71'
        id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.71'
    }
    
    repositories {
        jcenter()
        mavenCentral()
    }
    
    //apply plugin: 'com.android.library'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'kotlinx-serialization'
    //android {
    //    compileSdkVersion 28
    //    buildTypes {
    //        release {
    //            minifyEnabled false
    //        }
    //    }
    //}
    
    kotlin {
        // This is for iPhone emulator
        // Switch here to iosArm64 (or iosArm32) to build library for iPhone device
        targets {
            final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
                              ? presets.iosArm64 : presets.iosX64
    
            fromPreset(iOSTarget, 'ios') {
                binaries {
                    framework("framework")
                }
            }
            fromPreset(presets.jvm, 'android')
        }
    
        def ktor_version = "1.3.0-rc"
        def serialization_version = "0.14.0"
        def coroutines_version = "1.3.5"
        def klock_version = "1.7.0"
    
        sourceSets {
            commonMain {
                dependencies {
                    implementation kotlin('stdlib-common')
                    implementation "io.ktor:ktor-client-core:$ktor_version"
                    implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
                    implementation "io.ktor:ktor-client-json:$ktor_version"
                    implementation("io.ktor:ktor-client-okhttp:$ktor_version")
                    implementation "io.ktor:ktor-client-serialization:$ktor_version"
                    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version"
                    implementation "com.soywiz.korlibs.klock:klock:$klock_version"
                }
            }
            commonTest {
                dependencies {
                    implementation kotlin('test-common')
                    implementation kotlin('test-annotations-common')
                }
            }
            androidMain {
                dependencies {
                    implementation kotlin('stdlib')
                    implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$serialization_version"
                    implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
                }
            }
            androidTest {
                dependencies {
                    implementation kotlin('test')
                    implementation kotlin('test-junit')
                }
            }
            iosMain {
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
                implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
            }
            iosTest {
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
            }
        }
    }
    
    // This task attaches native framework built from ios module to Xcode project
    // (see iosApp directory). Don't run this task directly,
    // Xcode runs this task itself during its build process.
    // Before opening the project from iosApp directory in Xcode,
    // make sure all Gradle infrastructure exists (gradle.wrapper, gradlew).
    task copyFramework {
        def buildType = project.findProperty('kotlin.build.type') ?: 'DEBUG'
        def target = project.findProperty('kotlin.target') ?: 'ios'
        dependsOn kotlin.targets."$target".binaries.getFramework(buildType).linkTask
    
        doLast {
            def srcFile = kotlin.targets."$target".binaries.getFramework(buildType).outputFile
            def targetDir = getProperty('configuration.build.dir')
            copy {
                from srcFile.parent
                into targetDir
                include 'shared.framework/**'
                include 'shared.framework.dSYM'
            }
        }
    }
    I also have
    enableFeaturePreview("GRADLE_METADATA")
    but i couldn't resolve dependencies in my
    iosMain
    . What am i missing here? Thanks
    y
    r
    • 3
    • 4
  • d

    Davide Giuseppe Farella

    04/26/2020, 11:16 AM
    I can’t understand why my jvm module (
    commandline
    ) cannot resolve dependencies from other multiplatform modules ( my source code only ) anymore.
    For example I got a
    domain
    like
    kotlin {
      jvm()
      js()
    
      sourceSets {
    
        val commonMain by getting {
        dependencies {
          api(`kotlin-common`)
          api(`coroutines-core-common`)
         }
        }
    
        val jvmMain by getting {
          dependencies {
            api(`kotlin-jdk8`)
            api(`coroutines-core`)
          }
        }
        
      }
    }
    and got
    commandline
    like
    kotlin {
    
      sourceSets {
    
        val main by getting {
        dependencies {
          implementation(project(":domain")
         }
        }
        
      }
    }
    But it can resolve all the dependencies exposed by
    api
    in domain ( kotlin, coroutines, koin, etc ), but cannot resolve from my sourceSet ( like
    my.project.domain.MyClass
    ) For some reason it was working before, I think it stopped to work after I added an android module ( which, differently from
    commainline
    , it’s working flawlessly ) #FYI: I got
    enableFeaturePreview("GRADLE_METADATA")
    r
    • 2
    • 6
  • j

    Javier

    04/26/2020, 4:50 PM
    I am having problems to run test from terminal
    Task 'test' not found in root project 'MyRootProject'
    , But I can run jvmTest via IntelliJ without problems
    m
    • 2
    • 4
  • a

    Amanjeet Singh

    04/27/2020, 5:07 AM
    Need a piece of advice, I was writing a repository in
    commonMain
    using coroutines. Normally, the methods in android would be marked by
    suspend
    and then they can fetch any data from remote or local. Also writing tests to this on JVM (Android in my case) is easy as we can create a
    runBlocking
    and assert the results. But when it comes to iOS we don't have any
    suspend
    methods and thus the same function cannot be tested and thus we end up adding a high order function which will give you an
    onSuccess
    or
    onFailure
    when
    launch
    coroutine gives result. This seems to be a bit messy to me because in common we end up maintaining 2 implementations for fetching same data each for android and iOS. (common is not "common" anymore in this case) I need an approach which can be directly exposed to both worlds with unit tests also working on both sides. How you guys create repositories and unit test them? Advices and approaches would be appreciated 🙂
    ➕ 1
    e
    k
    +2
    • 5
    • 22
  • v

    Victor Grigorev

    04/27/2020, 9:52 AM
    Hello! I wanna try to use Periphery (https://github.com/peripheryapp/periphery) static code analyzer in my iOS project, but I get error using Periphery script via the terminal:
    Undefined symbols for architecture arm64:
    "_OBJC_CLASS_$_IosCombinedDialogModelAlign", referenced from:
    objc-class-ref in StringExtensions.o
    "_OBJC_CLASS_$...
    ...
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    What I need to do?
    a
    • 2
    • 5
  • s

    Sean Keane

    04/27/2020, 2:45 PM
    Hi All! I have a project where im building for Android , iOS and JS and I'm wondering what is the best time library to use for all three platforms? I tried Klock but it gives me JS issues.
    e
    • 2
    • 3
  • z

    ZabGo

    04/27/2020, 3:09 PM
    I am trying Kotlin Multiplatform on a Mac to develop an iOS app.  I cannot access UIDevice, I get “unresolved reference: UIDevice”.  Does someone have any idea where the issue could come from? I am maybe missing something in my gradle config. The android studio kotlin plugin has the version 1.3.72. Thanks in advance for your help! Here my gradle files Build.gradle (project)
    buildscript {
      ext.kotlin_version = '1.3.72'
      repositories {
        google()
        jcenter()
         
      }
      dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
    
    
    
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
      }
    }
    
    allprojects {
      repositories {
        google()
        jcenter()
         
      }
    }
    build.gradle(module)
    plugins {
      kotlin("multiplatform")
    }
    
    Kotlin{
    iosX64("ios"){
      binaries {
        framework {
          baseName = "SharedCode"
        }
      }
    }
    
    jvm("android")
    
    
      sourceSets["commonMain"].dependencies {
        implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
        implementation("io.ktor:ktor-client-core:1.3.2")
        implementation("io.ktor:ktor-client-json:1.3.2")
        implementation("io.ktor:ktor-client-serialization:1.3.2")
      }
    
      sourceSets["androidMain"].dependencies {
        implementation("org.jetbrains.kotlin:kotlin-stdlib")
        implementation("io.ktor:ktor-client-android:1.3.2")
    
      }
    
      sourceSets["iosMain"].dependencies{
        implementation("org.jetbrains.kotlin:kotlin-stdlib")
        implementation("io.ktor:ktor-client-ios:1.3.2")
        implementation("io.ktor:ktor-client-json-native:1.3.2")
        implementation("io.ktor:ktor-client-serialization-native:1.3.2")
    
      }
    }
    p
    m
    • 3
    • 53
  • s

    Shawn Karber_

    04/27/2020, 3:24 PM
    I am running into some issues I didn't expect porting some Kotlin code that I wrote into Kotlin Multiplatform. It works in a standalone Kotlin app, but not in Kotlin Multiplatform, and I'm assuming they have to be written differently in common.kt? Any suggestions on how to fix these common uses:
    fun convertHexToBitString(dataString: String) : String {
                val binaryArray: MutableList<String> = arrayListOf()
                dataString.toCharArray().forEach {
                    val binValue =
                        if (it.isDigit()) {
                            String.format("%4s",
                                           Integer.toBinaryString(Character.getNumericValue(it)))
                                           .replace(' ', '0')
                        } else {
                            when(it.toUpperCase()) {
                                'A' -> "1010"
                                'B' -> "1011"
                                'C' -> "1100"
                                'D' -> "1101"
                                'E' -> "1110"
                                'F' -> "1111"
                                else -> "Invalid hexadecimal digit in string."
                            }
                        }
                    binaryArray.add(binValue)
                }
                return binaryArray.joinToString("")
    it.isDigit() is not working in common.kt, nor is Character.getNumericValue, and neither is String.format(). Are any of these accessible through another means in Kotlin Multiplatform?
    s
    s
    r
    • 4
    • 3
  • m

    Madhan

    04/27/2020, 4:08 PM
    Hi All, Is it possible to use existing android project for multiplatform project to share my network layer between android and ios.
    🇳🇴 2
    f
    c
    • 3
    • 4
  • e

    edenman

    04/27/2020, 8:27 PM
    anybody already written a common kotlin
    val Char.isEmoji: Boolean
    helper? The Char api is pretty limited and all my stackoverflow results are jvm or iOS specific
    s
    • 2
    • 4
  • m

    mbonnin

    04/27/2020, 11:06 PM
    When running macosX64 tests, how can I read a resource file ? Or have access to the test directory, similar to
    System.getProperty("user.dir")
    on the JVM ?
    • 1
    • 1
  • c

    curioustechizen

    04/28/2020, 9:06 AM
    I don't know if this should be here or in #kotlin-native but here goes: Is
    resumeWith
    on
    kotlin.coroutines.Continuation
    a mutating operation? If so, how can I share it with another thread in order to bridge callback-style APIs and suspend functions? My scenario: I have a suspend function in a shared API (shared between Android and iOS). On Android I just implement it as a regular suspend function. On iOS, I'm attempting to use
    continuation
    and call it from my callback. • If I freeze the continuation object I receive
    InvalidMutabilityException
    , • if I don't freeze it, I receive
    IncorrectDereferenceException
    . I'm using coroutines 1.3.5-native-mt
    • 1
    • 2
Powered by Linen
Title
c

curioustechizen

04/28/2020, 9:06 AM
I don't know if this should be here or in #kotlin-native but here goes: Is
resumeWith
on
kotlin.coroutines.Continuation
a mutating operation? If so, how can I share it with another thread in order to bridge callback-style APIs and suspend functions? My scenario: I have a suspend function in a shared API (shared between Android and iOS). On Android I just implement it as a regular suspend function. On iOS, I'm attempting to use
continuation
and call it from my callback. • If I freeze the continuation object I receive
InvalidMutabilityException
, • if I don't freeze it, I receive
IncorrectDereferenceException
. I'm using coroutines 1.3.5-native-mt
I receive these exceptions at the point that I call
continution.resumeWith
in my Swift code
For anyone interested in this, with coroutines 1.3.5-native-mt this does not work. I ended up using coroutines-worker library from Autodesk to get this to Work
View count: 3