https://kotlinlang.org logo
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
  • a

    Alfred Lopez

    12/16/2020, 7:43 PM
    So....is there a Kotlin equivalent to System?
    b
    i
    • 3
    • 29
  • t

    Tristan

    12/16/2020, 10:30 PM
    Hello, I am trying to use cocoapods by following this documentation: https://kotlinlang.org/docs/reference/native/cocoapods.html But I am encountering the following error. Do you have an idea of what I could be missing? I use the version
    1.4.21
    , with
    kotlin {
        android()
        ios()
    
        cocoapods {
            summary = "summary"
            homepage = "homepage"
    
            pod("AFNetworking") {
                version = "~> 4.0.1"
            }
        }
    // ...
    Untitled
    a
    • 2
    • 8
  • c

    carlos cdmp

    12/17/2020, 2:30 PM
    As I am using ktor client for networking, is there a way to directly get the call executed inside a Kotlin Flow or, even better, StateFlow?
    m
    • 2
    • 4
  • a

    Alfred Lopez

    12/17/2020, 5:16 PM
    After reading a bit, I found out that runBlocking is only available for JVM. Can I assume that await() is also JVM only? If so, how do I refactor my code to maintain the same behavior? Thanks!
    m
    a
    • 3
    • 15
  • k

    kevinskrei

    12/17/2020, 7:25 PM
    Does anyone know how I can resolve an issue running
    pod lib lint
    on the podspec for a kotlin native mpp project? I have the framework built in the
    build/cocoapods/framework
    folder successfully. I'm looking to deploy it to our private pod repo. I run
    pod lib lint
    on the podspec and it errors out at:
    - ERROR | xcodebuild: Returned an unsuccessful exit code.
    /bin/sh -c /Users/kevinskrei/Library/Developer/Xcode/DerivedData/App-bvyatnpkzbcdlihdrsoatdifsqvt/Build/Intermediates.noindex/Pods.build/Release-watchsimulator/arccosAbShared.build/Script-46EB2E000002E0.sh
                        REPO_ROOT="$PODS_TARGET_SRCROOT"
                        "$REPO_ROOT/../gradlew" -p "$REPO_ROOT" :shared:syncFramework                     -Pkotlin.native.cocoapods.target=$KOTLIN_TARGET                     -Pkotlin.native.cocoapods.configuration=$CONFIGURATION                     -Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS"                     -Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS"                     -Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"
        
        FAILURE: Build failed with an exception.
        
        * What went wrong:
        Gradle could not start your build.
        > Could not create service of type CrossBuildFileHashCache using BuildSessionServices.createCrossBuildFileHashCache().
           > Failed to create parent directory '/.gradle' when creating directory '/.gradle/6.4.1/fileHashes'
    Has anyone run into this before when trying to publish a pod? This is using the pod spec from the cocoapods plugin
    a
    v
    • 3
    • 8
  • a

    Artur Matsehor

    12/18/2020, 12:12 PM
    Hi folks! Is anyone here using a "Debug iOS application" feature of KMM plugin for Android Studio ? Could someone check if it works okay please? In my case, a simulator doesn't even launch - only the empty "Run" tab shows up macOS 11.1 beta, Simulator 12.2
    t
    • 2
    • 2
  • e

    Eric Ampire [MOD]

    12/18/2020, 4:39 PM
    Hi, what do you think can be the cause when there is no more autocompletion in the shared module of a KMM project? And once in the Android tab, only the java(generated) folder appears
    l
    a
    • 3
    • 3
  • r

    Robert Jaros

    12/18/2020, 11:14 PM
    I have a Kotlin/JS project with Kotlin/MPP subproject (JS/JVM). When I run
    ./gradlew test
    only JS tests are executed from the main project and subprojects. I can run
    ./gradlew jvmTest
    to run JVM tests from the MPP subproject, but how can I run all tests with a single
    test
    task?
    r
    • 2
    • 3
  • s

    Sergio Pro

    12/19/2020, 1:23 PM
    Hi all 👋 I'm trying to publish a lib and I noticed that some jars are missing - common is missing sources.jar and native only has sources jar. Is this some limitation of kotlin mpp or am I doing something wrong? Here's the build file just in case: https://github.com/serpro69/todo-or-die/blob/master/build.gradle.kts Thanks.
    s
    • 2
    • 2
  • s

    Sarvesh Sharma

    12/21/2020, 8:25 AM
    I'm using Touchlab's CrashKiOS to try to view my crashes happening in the KMM module, I'm still not able to view the actual crashes and the stack trace I see on the portal is from Xcode only, i.e., till the KMM interface visible in Xcode. I've located all the dSYMs in the system and added them to the upload script. I'm using the latest version for Crashlytics, i.e., Firebase Crashlytics for the same.
    a
    k
    • 3
    • 10
  • u

    uli

    12/21/2020, 4:17 PM
    Hi All, i would appreciate your comments on my dev.to post before I publish. Feel free to reply here or to PM me. Thanks alot. https://dev.to/uluckas/the-future-of-cross-platform-development-kotlin-multiplat[…]7a586399465a9ca6bd43456a6ee942998c3b783a6a94f37aa6910541dee0b49b2 I hope this is the right channel. If not, please let me know.
    a
    • 2
    • 2
  • a

    Arkadii Ivanov

    12/21/2020, 7:44 PM
    In my Decompose library, I see that starting from Kotlin version
    1.4.20
    the
    maven-publish
    plugin uploads
    jar
    files for root packages (named without any a suffix). But there is no
    sources.jar
    uploaded. As a result I can't enable JCenter sync, since sources are mandatory for packages with
    jars
    . E.g. this package has a
    jar
    file but does not have
    sources.jar
    file: https://dl.bintray.com/arkivanov/maven/com/arkivanov/decompose/decompose/0.1.4/ But e.g. this coroutines package has everything: https://jcenter.bintray.com/org/jetbrains/kotlinx/kotlinx-coroutines-core/1.4.2/ Questions: 1. Why there is no
    jar
    files uploaded for this package prior to Kotlin 1.4.20? (e.g. here). If there is no
    jar
    then it's ok to not have
    sources.jar
    . 2. Why there is no
    sources.jar
    uploaded in this case. Sources are uploaded fine for other non-root packages, e.g. the decompose-jvm.
    👀 1
    s
    • 2
    • 2
  • a

    Amritansh

    12/22/2020, 11:32 PM
    Is there a way to have concurrentHashMaps in Kotlin Native? I tried wrapping MutableMap in AtomicReference but that doesn't look like a good solution to me as there are cases in which it might not work
    d
    m
    • 3
    • 3
  • o

    Ola Adolfsson

    12/23/2020, 6:50 AM
    Hi regarding https://youtrack.jetbrains.com/issue/KT-43237, are there more people affected? In our case we need to do a somewhat orthodox workaround renaming the imports to the affects js libs. “KJS:
    -jsLegacy
    Naming Convention is incompatible with NPM
    Libraries such as 
    kotlinx.serialization
     are exporting artifacts with a 
    -jsLegacy
     suffix when using the legacy compiler with Kotlin 1.4. NPM however, doesn’t allow capital letters in package names.”
    ➕ 3
    p
    a
    +2
    • 5
    • 16
  • e

    Eugeny Sentsov

    12/23/2020, 9:21 AM
    Hi! Does anyone know if there is a way to implement this idea https://github.com/JetBrains/kotlin-native/issues/2423#issuecomment-491252243 ? Like to have a multiplatform module built into a set of frameworks (one for each api dependency)
    j
    k
    • 3
    • 4
  • j

    Jeff

    12/23/2020, 10:03 AM
    Anyone facing this error when updating multiplatform project to: Android Studio Artic Fox | 2020.3.1 Canary 3 Gradle version: gradle-6.8-rc-4-bin.zip Gradle plugin: 7.0.0-alpha03
    A problem occurred configuring project ':shared'.
    > Configuration with name 'testApi' not found.
    
    * Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Exception is:
    org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':shared'.
    	at..........
    t
    • 2
    • 5
  • r

    rb90

    12/23/2020, 3:59 PM
    Hi all, I am a Kotlin beginner and I decided to play a little bit around with Kotlin Multiplatform. I am looking for a way to version a shared module - so I started think about using jfrog artifactory for that purpose. Did anyone of you already upload a Kotlin Multiplatform shared module to artifactory an consume it from there?
    ✅ 1
    k
    • 2
    • 18
  • j

    Jakob K

    12/24/2020, 12:22 PM
    Hey, I want to use the kotlin multiplatform plugin for gradle within a precompiled plugin (inside of the buildSrc folder) - but it does not work. Does this really just not work or is there a problem inside of my gradle script files?
    j
    • 2
    • 39
  • s

    Scott Whitman

    12/24/2020, 1:19 PM
    I am working on a library using KMP.
    KClass.objectInstance
    doesn't seem to be available on JS or Native, only JVM. Are there any workarounds or libraries that I can use with expext/actual to accomplish something similar to
    T::class.objectInstance
    m
    r
    • 3
    • 7
  • m

    Md Hanif

    12/24/2020, 3:38 PM
    Hi I am learning KMM and got confused how to set our base url in our shared module according to the build variants(development, production etc). I can't access
    BuildConfig
    which we have in out android projects.
    j
    g
    • 3
    • 9
  • m

    Mustafa Ozhan

    12/24/2020, 3:59 PM
    Hello 👋 I have two questions • is there any example of having color resources in
    common
    ? And share it between Android and iOS? also supporting Dark/Light mode ?
    a
    • 2
    • 2
  • m

    Mustafa Ozhan

    12/24/2020, 4:00 PM
    Second one, • is there any example of having images(.png) and vector drawables (.xml) in
    common
    and sharing across platforms ?
    a
    • 2
    • 8
  • w

    widar

    12/24/2020, 6:16 PM
    Heyoo! I'm dabbling for the first time in multiplatform with web and jvm in a fullstack web app. If followed the hands on tutorial but adapted it to my needs, so now I have a very basic project with React. I'd like to use the https://material-ui.com framework for the layout. Is there anyone that has managed to do this? 😊
    r
    • 2
    • 7
  • j

    jaqxues

    12/24/2020, 8:15 PM
    I have a Multiplatform Project (js, jvm, native). What is the best approach if I want to have tests for common code? Can I configure common-test to run tests on the JVM, or should I put all of that inside the jvmTest module? Is there any good "optimal solution" example on github that I can follow?
    s
    • 2
    • 5
  • v

    Vlad Ivanov

    12/24/2020, 8:16 PM
    Hi, can someone suggest with freeze() method. Is it a bug or I do something wrong: I create instance of Kotlin data class from Swift. Then I pass this instance to Kotlin code, where I call freeze() for passing it to another thread. Per documentation freeze() should freeze this instance and its subgraph. But I found that It freezes only itself. Subgraph stays untouched and not frozen. Example:
    data class Foo(val bars: List<Bar>)
    
    // create instance of Foo with bars on Swift side and pass it to some Kotlin Multiplatform class where I call
    foo.freeze()
    // now I expect that bars are frozen, but they are not
    // as a workaround I use
    foo.bars.forEach { it.freeze() }
    When I do the same purely in Kotlin - everything works as expected, instance of Foo is frozen and all its properties
    a
    n
    s
    • 4
    • 5
  • q

    Qracle

    12/25/2020, 5:00 AM
    Hi, does anyone know how to fix running the iOS simulator from Android Studio canary (latest version), it’s able to build the iOS app just fine, but it doesnt bring up the simulator, just stuck on the
    Run
    tab. I’m able to run the app from Xcode just fine too.
    a
    • 2
    • 2
  • k

    Krotick

    12/26/2020, 6:13 PM
    I have tried to use KTor for a KMM (Kotlin Multiplatform Mobile) project but the shared module (commonMain) doesn't see the ktor library after I've added it as a dependency ... Anyone had success with using KMM with KTor in the shared module or is it not ready yet?
    m
    j
    c
    • 4
    • 5
  • a

    andylamax

    12/26/2020, 7:41 PM
    Hi, I am having scenerios where I get
    NoSuchMethod
    in jvm runtime. It is multiplatform code that executes well in kotlin/js browser, but fails in jvm implementation looks something like this // in submodule
    common
    interface ICommon 
    
    fun ICommon.greet(greeting: String, name: String)
    // in submodule
    client
    which depends on common
    interface IClient : ICommon
    
    class ClientImpl(): IClient
    // my tests in submodule
    client
    class
    ClientImpl().greet("Hello","World");
    Passes on js/browser, fails on jvm using IR for both JVM and JS
    c
    • 2
    • 3
  • a

    ahmedre

    12/28/2020, 11:32 AM
    Hi, curious if SwiftUI previews still work for everyone with Kotlin 1.4.21 and Xcode 12.3 - tried both with my project and with @John O'Reilly’s PeopleInSpace, but getting the same crash during preview:
    Application Specific Information:
    abort() called
    CoreSimulator 732.18.6 - Device: iPod touch (7th generation) (DE2D8C92-2BA3-4592-8CF0-D838EA741FBC) - Runtime: iOS 14.3 (18C61) - DeviceType: iPod touch (7th generation)
    
    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0   libsystem_kernel.dylib        	0x00007fff60c58462 __pthread_kill + 10
    1   libsystem_pthread.dylib       	0x00007fff60c91610 pthread_kill + 263
    2   libsystem_c.dylib             	0x00007fff200fab94 abort + 120
    3   MorphologyWordView.2.preview-thunk.dylib	0x000000010f035b19 konan::abort() + 9
    4   MorphologyWordView.2.preview-thunk.dylib	0x000000010f03598c RuntimeAssertFailed(char const*, char const*) + 156
    5   MorphologyWordView.2.preview-thunk.dylib	0x000000010f04fa8f __Kotlin_ObjCExport_initialize_block_invoke + 1055
    6   libdispatch.dylib             	0x00007fff20106508 _dispatch_client_callout + 8
    7   libdispatch.dylib             	0x00007fff2010775d _dispatch_once_callout + 20
    8   MorphologyWordView.2.preview-thunk.dylib	0x000000010f04f664 Kotlin_ObjCExport_initialize + 36
    9   MorphologyWordView.2.preview-thunk.dylib	0x000000010eb1bab7 +[KotlinBase initialize] + 55
    10  libobjc.A.dylib               	0x00007fff20178453 CALLING_SOME_+initialize_METHOD + 17
    11  libobjc.A.dylib               	0x00007fff20179326 initializeNonMetaClass + 717
    12  libobjc.A.dylib               	0x00007fff201790b0 initializeNonMetaClass + 87
    13  libobjc.A.dylib               	0x00007fff2017a3ad initializeAndMaybeRelock(objc_class*, objc_object*, mutex_tt<false>&, bool) + 173
    14  libobjc.A.dylib               	0x00007fff20185b8f lookUpImpOrForward + 668
    15  libobjc.A.dylib               	0x00007fff2017421b _objc_msgSend_uncached + 75
    16  MorphologyWordView.2.preview-thunk.dylib	0x000000010f39a73e type metadata accessor for SharedCodeWordMorphology + 30
    17  net.cafesalam.QuranSearch     	0x000000010c147d33 static MorphologyWordView_Previews.previews.getter + 115 (MorphologyWordView.swift:37)
    18  net.cafesalam.QuranSearch     	0x000000010c148489 protocol witness for static PreviewProvider.previews.getter in conformance MorphologyWordView_Previews + 9
    actual app works fine on both Android and iOS - and in my case at least this is just a
    data class
    that i am using in the preview / swift ui code that causes this crash. i saw a similar part of the crash reason in the case of PeopleInSpace also:
    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0   libsystem_kernel.dylib        	0x00007fff60c58462 __pthread_kill + 10
    1   libsystem_pthread.dylib       	0x00007fff60c91610 pthread_kill + 263
    2   libsystem_c.dylib             	0x00007fff200fab94 abort + 120
    3   ContentView.2.preview-thunk.dylib	0x000000010451b0d9 konan::abort() + 9
    4   ContentView.2.preview-thunk.dylib	0x000000010451af4c RuntimeAssertFailed(char const*, char const*) + 156
    5   ContentView.2.preview-thunk.dylib	0x000000010453504f __Kotlin_ObjCExport_initialize_block_invoke + 1055
    6   libdispatch.dylib             	0x00007fff20106508 _dispatch_client_callout + 8
    7   libdispatch.dylib             	0x00007fff2010775d _dispatch_once_callout + 20
    8   ContentView.2.preview-thunk.dylib	0x0000000104534c24 Kotlin_ObjCExport_initialize + 36
    9   ContentView.2.preview-thunk.dylib	0x0000000104532a02 (anonymous namespace)::initRuntime() + 194
    10  ContentView.2.preview-thunk.dylib	0x00000001045325af Kotlin_initRuntimeIfNeeded + 31
    11  ContentView.2.preview-thunk.dylib	0x0000000104003dbe -[NSArray(NSArrayToKotlin) toKotlin:] + 30
    12  com.surrus.PeopleInSpaceSwiftUI	0x000000010108fc61 Kotlin_Interop_refFromObjC + 65
    13  com.surrus.PeopleInSpaceSwiftUI	0x00000001011b0006 kfun:co.touchlab.sqliter.DatabaseFileContext#iosDirPath(kotlin.String){}kotlin.String + 566
    anyone have any luck working around this or any ideas of what to look at?
    • 1
    • 1
  • m

    Michal Klimczak

    12/28/2020, 3:19 PM
    is there any pattern for faking Kotlin classes exposed to Swift? Let's say I have
    LoadUserUseCase
    in my Kotlin shared code. In Swift i have a
    UserViewModel
    which has the usecase injected. Now i want to write tests for this ViewModel, so I need to create a fake. But there is no protocol to conform to and of course
    Cannot inherit from non-open class 'LoadUserUseCase' outside of its defining module
    r
    • 2
    • 2
Powered by Linen
Title
m

Michal Klimczak

12/28/2020, 3:19 PM
is there any pattern for faking Kotlin classes exposed to Swift? Let's say I have
LoadUserUseCase
in my Kotlin shared code. In Swift i have a
UserViewModel
which has the usecase injected. Now i want to write tests for this ViewModel, so I need to create a fake. But there is no protocol to conform to and of course
Cannot inherit from non-open class 'LoadUserUseCase' outside of its defining module
r

russhwolf

12/28/2020, 3:26 PM
Make
LoadUserUseCase
an interface instead of a class. It will translate to Swift as a protocol you can implement.
m

Michal Klimczak

12/28/2020, 3:27 PM
ha, I just started to do that, but didn;t know if it would work, thank you!
View count: 6