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

    Mustafa Ozhan

    01/19/2021, 2:39 PM
    What is the advantage of adding shared modules into IOS via Cocoapods ? Is there any performance/capability benefits ? I saw many repo that use Cocoapods for that but couldn’t find any explanation why
    s
    j
    +3
    • 6
    • 7
  • r

    rb90

    01/19/2021, 3:28 PM
    Hi, how can the test coverage be measured in a kotlin multiplatform shared module for all module components (commonMain, iosMain, androidMain)? Jacoco does not support kotlin multiplatform from what I read.
    t
    • 2
    • 5
  • m

    Megan Teahan

    01/19/2021, 7:51 PM
    Hello all, I had a question about Multiplatform use. I was thinking about setting up a project I’m working on in a way, and just wanted to see if people saw any early gotcha’s because of Kotlin’s iOS Framework’s “closed world” concept. I’m creating a Multiplatform library that has a module for requesting data, running authentication, and an umbrella module that references dataSource and auth to create a framework for iOS.
    dataSource
    auth
    umbrella
    The auth module holds a common interface for an auth flow I want apps to follow. Because of issues I was having importing iOS frameworks into Kotlin, I was thinking of just creating a Swift Auth Module (I’m new to iOS development so I apologize if that’s not the right language) that would pull in the Kotlin auth framework and make an iOS implementation of that auth interface.  Then my client would pull in the umbrella framework created and also this Swift Auth module/framework.  Would this potentially collide because the Swift Auth Module is referencing one Kotlin Multiplatform framework and the client is also referencing the Kotlin umbrella framework? Or do people have other recommendations on how to tackle this?
    • 1
    • 1
  • j

    Jack Darlington

    01/19/2021, 8:24 PM
    Hello, I have dependencies on Firebase to use in iOS. I add them to my cocoapods section in gradle, and the first time it builds it is really slow(almost 30 mins) and makes my computer heat up. Anyway of speeding this up? Particularily happens on podBuildFirebaseIphoneos task. my cocoapods section
    ios()
    cocoapods {
        ...
        pod("Firebase/Auth", moduleName = "FirebaseAuth")
        pod("Firebase/Firestore", moduleName = "FirebaseFirestore")
        pod("FirebaseMessaging", moduleName = "FirebaseMessaging")
        ...
    }
    Is this normal?
    t
    • 2
    • 4
  • j

    Jeff Lockhart

    01/19/2021, 9:07 PM
    Is it possible for an expect declaration to use an interface, where the actual implementation implements the interface signature? For example:
    // commonMain
    
    expect class FooClass : BarInterface {
        fun fooFun()
    }
    
    interface BarInterface {
        fun barFun()
    }
    
    // androidMain
    
    actual typealias FooClass = FooImpl
    
    class FooImpl {
        fun fooFun() {}
        fun barFun() {}
    }
    I get the error on `typealias FooClass`:
    Actual typealias 'FooClass' has no corresponding expected declaration The following declaration is incompatible because some supertypes are missing in the actual declaration:
    public final expect class FooClass : BarInterface defined in ...
    FooImpl
    is from a library, so it’s not a class I can modify. But I’m trying to simplify declaring the expect API, as there are several classes that have the same interface.
    b
    • 2
    • 2
  • k

    Kishore

    01/19/2021, 11:54 PM
    Hi, I'm just starting to get familiar with Kotlin Multiplatform. Regarding
    dates/times
    , I'm currently using threeTenBP for both Android and Server. I'm curious, what is the approach for dealing with
    DateTime
    as its fairly complex with types ( LocalDate, LocalTime, LocalDateTime ) ? Thanks!
    k
    • 2
    • 1
  • l

    Lammert Westerhoff

    01/20/2021, 11:42 AM
    Hi everyone. Me and @Jamie Craane have created a gradle plugin to help with cross platform localization. Simply said, you create one file with all strings in all languages and the plugin will generate Kotlin native code so you can use those strings in a shared project (for example a view model). It also creates actual implementations for iOS, Android and JS. We’ve just open sourced it and are in early stages but are looking for feedback and contributions. Have a look at https://github.com/jcraane/kmm-resources/
    n
    a
    j
    • 4
    • 9
  • d

    David Hart

    01/20/2021, 1:28 PM
    I'm trying to access
    Thread.currentThread()
    from a Kotlin Mobile Multiplatform project to check that I am in the main thread, but it doesn't seem accessible. Are my missing something? Is there another way?
    a
    k
    +2
    • 5
    • 6
  • z

    zeugederunity

    01/21/2021, 8:26 AM
    Hello everyone, sometimes when Gradle reloads my multiplatform project, IntelliJ "forgets" the source folders for kotlin in the commons, js and/or jvm project (see screenshot) Does anyone know what causes this bug? Or how to "repair" it? Many thanks in advance! Best regards Felix
    ☝️ 1
    j
    m
    • 3
    • 5
  • d

    David Hart

    01/21/2021, 1:03 PM
    For example, if a library supports Kotlin Native, does it necessarily support KMM?
    b
    • 2
    • 11
  • m

    Michal Klimczak

    01/21/2021, 2:59 PM
    I have a dependency issue in multiplatform project and I have prepared a minimum example to show it: https://github.com/micHar/kmm-dependency-issues/tree/master In short - cannot access multiplatform module classes in unit tests of a jvm-only module (NoClassDefFound). Would be super cool if someone could point me in the right direction. Maybe I'm doing something wrong or maybe it's a limitation or a new bug I can report. Please take a look guys.
    • 1
    • 1
  • c

    chi

    01/21/2021, 5:08 PM
    How do I make sure I'm able to consistently access shared module code from swift code on Xcode? Sometimes I see the classes, other times I can't see it and opening the shared module (on xcode) it's just empty. This is very confusing and frustrating
    m
    • 2
    • 3
  • e

    Emil Kantis

    01/22/2021, 11:03 AM
    Is it possible to have a single implementation used for both JVM and Native if all code I've written myself is platform-agnostic?
    m
    • 2
    • 4
  • f

    Francis Mariano

    01/22/2021, 11:45 AM
    Hello. Is anyone with problem to add 3rd party library in iOS side project? For example, I want to add Cartography or SnapKit on iOS project, so I have created the Podfile and execute 
    pod install
     command, until here with no problem. However when I build the code on Xcode I get the following message:
    Link /Users/engenharia/Library/Developer/Xcode/DerivedData/iosApp-ebvxupurowfpqseswfpszjmhtudk/Build/Products/Debug-iphonesimulator/iosApp.app/iosApp
    ld: framework not found SnapKit
    Ok, so I thought is necessary to add also the cocoapods library in common code. I did that normally with:
    kotlin("native.cocoapods")
    ios()
    cocoapods {
        summary = "Test"
        homepage = "me"
    
        ios.deploymentTarget = "10.0"
    
        pod("SnapKit", "~> 5.0")
    }
    Ok, all the tasks were executed with success. Again in xcode after the build the code I get a new error message:
    > Task :shared:cinteropSnapKitIosX64 FAILED
    Exception in thread "main" java.lang.Error: /var/folders/l8/vxy_yfbx3wz2z0q_r5068d2h0000gn/T/tmp3849060542759213327.m:1:9: fatal error: module 'SnapKit' not found
    In according to the messahe the task shared:cinteropSnapKitIosX64 failed, but it is executed with success in Android Studio.
    a
    k
    • 3
    • 22
  • p

    Paul Dhaliwal

    01/22/2021, 2:22 PM
    Can someone explain to me the different use cases for Kotlin Multiplatform and Kotlin Multiplatform mobile? Reading through the KMM website, it seems to me that all the advantages listed also apply to the regular Kotlin Multiplatform. We are a small company and are looking to be able to re-use as much code as possible. The proposal I’ve set forth for my teammates is such: 1) We will use Kotlin Multiplatform to create a library (and eventually an sdk) to contain all of our shared business logic. 2) We will then create a flutter plugin to wrap the multiplatform library, which could be imported into our flutter projects, so we can again write our UIs with a single code base. The reason we’re doing this instead of just creating the library in pure Flutter is that we will eventually turn it into an SDK so that other companies can use it to make apps for their platform of choice. And since the core library would be made with Kotlin Multiplatform that would be possible. (we will continue making our UIs in Flutter since we have experience with it already and to again share code) I’ve successfully created a proof of concept covering the two points above using Kotlin Multiplatform Mobile + Flutter plugin, however, once we start the real work, I’m wondering if it would be better to use the regular Kotlin Multiplatform. After all, if it will generate a JS library for free as we develop, why not?
    k
    s
    • 3
    • 10
  • m

    Megan Teahan

    01/23/2021, 12:03 AM
    I'm writing a library that would be used for Android, iOS, and JS. I've got my first test set up, and when I go to run it, the drop down gives js and ios options to run but not jvm or android. I might be missing something simple, but any tips? I've set up the target as
    android
    and source folders for
    androidMain
    and
    androidTest
    .
    d
    a
    • 3
    • 2
  • m

    Md Hanif

    01/24/2021, 10:12 AM
    Hello. I'll appreciate if anyone can help me with this https://stackoverflow.com/questions/65624300/different-schema-for-ios-app-in-kotlin-multiplatform.
    a
    • 2
    • 6
  • w

    william

    01/24/2021, 4:34 PM
    if I create an extension function in common kotlin code - am I able to access it in swift?
    m
    • 2
    • 1
  • w

    william

    01/24/2021, 11:10 PM
    has anyone seen any multiplatform libraries to help with data paging? looking for something similar to android paging libraries to abstract network / database paging & fetching
    a
    m
    • 3
    • 3
  • m

    Michal Klimczak

    01/25/2021, 8:42 AM
    https://stackoverflow.com/questions/65830632/cant-access-commonmain-multiplatform-classes-from-a-jvm-only-module/ - put a bounty on that question 😉. seems that the config works for @kpgalligan but I've tried multiple times on different IDEs and different machines, my friends also tried and it consistently fails for us. Maybe I should just post to the issue tracker, but wanted to gain some insight before I do.
    y
    k
    +3
    • 6
    • 17
  • m

    Michal Klimczak

    01/25/2021, 6:47 PM
    I have created a codegen library which generates wrappers for coroutines and flows. Heavily inspired by @russhwolf's article about SuspendWrappers. This is an early preview, a lot will change. I'd appreciate your feedback and sincerely hope this will become useful for the community. https://github.com/FutureMind/kmm-ios-suspendwrapper
    👍 8
    r
    j
    +2
    • 5
    • 16
  • w

    wuseal

    01/26/2021, 7:34 AM
    Need help
    b
    k
    • 3
    • 5
  • w

    wuseal

    01/26/2021, 7:42 AM
    How do you guys debug Kotlin code when running iOS app? Use Android Studio KMM Plugin or Xcode Plugin? Bodys
    k
    k
    • 3
    • 10
  • c

    chi

    01/26/2021, 8:40 PM
    Are there projects using KMM for logic and others with Flutter for UI? Is this a good thing to do in production?
    w
    • 2
    • 4
  • w

    wuseal

    01/27/2021, 5:55 AM
    Hey, Is there any body use composit build with KMM?, when I
    includeBuild
    my KMM project into a normal android project, I can't reference my KMM shared library class in commonMain, but I can reference androidMain's classes in KMM project's sharedLibrary, Need I do any config else for that? Bros🤔
    p
    • 2
    • 1
  • d

    Daniele B

    01/27/2021, 11:08 AM
    Just wondering, is there anything that would prevent KMP code to be used for the business logic of the upcoming Harmony OS by Huawei?
    👀 1
    t
    • 2
    • 4
  • y

    Yaniv Sosnovsky

    01/27/2021, 1:16 PM
    Hi guys. Just to give some more information about @Shawn Tuckers message -> We are able to run the gradle scripts for • linkDebugFrameworkIosArm64 • linkReleaseFrameworkIosArm64 • linkReleaseFrameworkIosX64  and it runs properly. The only one that fails is linkDebugFrameworkIosX64. Any advice?
    k
    a
    • 3
    • 4
  • f

    Francis Mariano

    01/27/2021, 6:50 PM
    Hi guys. I need to build the shared code to arm32 architecture. So I add the following code in gradle file
    iosArm32 {
        binaries {
            framework {
                baseName = "shared"
            }
        }
    }
    After sync the gradle file the tasks to arm32 architecture were enabled. However, the task compileKotlinIosArm32 fails when executed. I noted that the expect/actual was not resolved for shared.iosArm32Main
    (Create actual class for module shared.iosArm32Main)
    Can any help me?
    k
    • 2
    • 3
  • m

    Marko Novakovic

    01/27/2021, 6:58 PM
    why YouTrack mobile app is written in React Native and not KMM? if they have their own solution which they are pushing so hard why use React Native? wouldn’t it be good advertising and proof that KMM is good and ready?
    g
    b
    • 3
    • 4
  • f

    Francis Mariano

    01/27/2021, 8:21 PM
    Hi guys again 🙂 I getting the following message after build and running based-arm32 shared code:
    dyld: Library not loaded: /usr/lib/libate.dylib
     Referenced from: /private/var/containers/Bundle/Application/ED5BC0AF-C75B-4DF3-92F5-C7B62B0F6DF5/myapp.app/Frameworks/shared.framework/shared
     Reason: image not found
    My packForXCode task is default, but I replace target name to Arm32:
    val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm32" else "X64"
    I search about this problem and found the following issue on kotlin-native github https://github.com/JetBrains/kotlin-native/issues/2555 but I don't understand very well. Again, I am new in iOS perspective and I am studying and learning very much with the community. Can any help? Thank you Edit: On simulator the build and running is ok
    t
    a
    • 3
    • 9
Powered by Linen
Title
f

Francis Mariano

01/27/2021, 8:21 PM
Hi guys again 🙂 I getting the following message after build and running based-arm32 shared code:
dyld: Library not loaded: /usr/lib/libate.dylib
 Referenced from: /private/var/containers/Bundle/Application/ED5BC0AF-C75B-4DF3-92F5-C7B62B0F6DF5/myapp.app/Frameworks/shared.framework/shared
 Reason: image not found
My packForXCode task is default, but I replace target name to Arm32:
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm32" else "X64"
I search about this problem and found the following issue on kotlin-native github https://github.com/JetBrains/kotlin-native/issues/2555 but I don't understand very well. Again, I am new in iOS perspective and I am studying and learning very much with the community. Can any help? Thank you Edit: On simulator the build and running is ok
t

Thomas Myrden

01/27/2021, 8:26 PM
What device are you building on?
f

Francis Mariano

01/27/2021, 8:27 PM
ipad 1srt generation (i kown, it is old)
t

Thomas Myrden

01/27/2021, 8:28 PM
Hmmmm, the iPad gen 1 stopped at iOS 5.1.1
I wasn't even dev'ing back in the iOS 5 days so I won't be much help here. I can't even begin to imagine the list of potential issues you could be having if you're attempting to target 5.1.1
f

Francis Mariano

01/27/2021, 8:31 PM
sorry, Ipad Mini. It is at iOS 9.3
t

Thomas Myrden

01/27/2021, 8:31 PM
Ah! Ok way more reasonable
a

Artyom Degtyarev [JB]

01/28/2021, 7:48 AM
Just a wild guess, but I’m looking at those two repos: ios9Headers, ios10Headers, and there is no
libate.dylib
presented in the ninth one. This is not the best source, but it made me think that maybe Kotlin/Native does not support some iOS version at the moment. I’ve found this answer, telling that Apple added libate only with iOS 10. Not sure why Kotlin/Native framework depends on it, probably worth an issue at kotl.in/issue Also there is a thread with some devices list, not sure how relevant is it: https://stackoverflow.com/questions/41916922/which-ios-devices-dont-support-astc-texture-compression
f

Francis Mariano

01/28/2021, 10:49 AM
Thank you @Artyom Degtyarev [JB] I will to open a issue in youtrack. In past I remember to test kotlin native with iOS 9.3 version and it worked like a charm, but very things must have changed from there.
Issue created https://youtrack.jetbrains.com/issue/KT-44588
View count: 3