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
kotlin-native
  • a

    ankushg

    10/02/2019, 8:24 PM
    Hey friends, anyone have any solutions for classname collisions across Gradle modules when building an iOS framework? My understanding is that I have to build a single framework file using
    export
    to bundle all the separate projects together. Throughout our Kotlin codebase we have packages like
    com.quizlet.module1.models.StudySet
    and
    com.quizlet.module2.models.StudySet
    where the implementations of the
    StudySet
    classes are a bit different depending on the module. This is currently causing issues for us because one of them gets mapped to
    QuizletFramework.StudySet
    and the other to
    QuizletFramework.StudySet_
    A few questions: 1. Am I correct that we have to build one mega-Framework instead of just having multiple frameworks with different names to avoid these collisions? 2. Is it potentially possible to have classes from each module prefixed with a unique value when exporting into one framework? 3. Is there any way around name collisions besides just ensuring that every class has a unique name? 4. Is there a way to enforce that there are no collisions at compile-time instead of running into the issue once we try consuming the framework later?
    k
    k
    n
    • 4
    • 10
  • b

    Big Chungus

    10/03/2019, 7:38 AM
    Hi all. By declaring native target in MPP plugin, it seems to download and setup
    .konan
    home dir for native compiler. How can I extract the property of that dir in gradle config?
    m
    • 2
    • 2
  • b

    Big Chungus

    10/03/2019, 8:04 AM
    After building the jsinterop for WASM available on K/N, i see it has a js file attached to it. How can I configure my gradle MPP WASM target to also include some custom files in that same dir when *.klib is being built?
    m
    • 2
    • 2
  • m

    msink

    10/03/2019, 12:13 PM
    1.3.60-eap-9
    appeared in
    kotlin-dev
    repository. K/N - 1.3.60-eap-12794 Already tried - works for me.
    👀 1
    j
    • 2
    • 2
  • b

    Big Chungus

    10/03/2019, 3:44 PM
    How can i run common module tests on native target?
    s
    • 2
    • 2
  • a

    ankushg

    10/03/2019, 5:59 PM
    Is there anything like
    @JvmOverloads
    when spitting out iOS frameworks with Kotlin/Native? Since Objective-C doesn't support default parameters, I was hoping to generate overloads like I'm used to with the JVM
    e
    • 2
    • 1
  • m

    mgrzechocinski

    10/04/2019, 10:24 AM
    Ok, I found some details here: https://github.com/JetBrains/kotlin-native/issues/3348
    m
    • 2
    • 5
  • j

    jromero

    10/04/2019, 3:21 PM
    Hi, I’m trying to achieve something similar to what this person asks about: https://discuss.kotlinlang.org/t/multiplatform-multiple-native-targets-same-source-code/11276 Basically, I want to have shared source for two targets (
    macos64
    and
    linuxX64
    ). They should both be able to utilize
    platform.posix
    and
    kotlin.system
    . Is there an example for setting up something like that? I tried to setup what the original Q/A had but IntelliJ showed that “Kotlin/Native 1.3.50 - stdlib” wasn’t an available dependency for that
    sourceSet
    .
    b
    l
    s
    • 4
    • 11
  • b

    Big Chungus

    10/06/2019, 12:53 PM
    Is there a way to hook a piece of code to be executed before the object is destroyed by gc?
    a
    • 2
    • 1
  • f

    Fudge

    10/07/2019, 11:16 PM
    https://github.com/JetBrains/kotlin-native/pull/3262 what is the ‘namespace rework’ that is mentioned here?
    a
    • 2
    • 1
  • u

    ursus

    10/08/2019, 9:12 AM
    I read coroutines dont work well, so network models maybe? But I need to switch to kotlin-serialization correct?
    r
    j
    • 3
    • 13
  • t

    Thomas

    10/08/2019, 6:11 PM
    Hi, why does
    platform.darwin.DISPATCH_DATA_DESTRUCTOR_DEFAULT
    not appear as a
    dispatch_block_t
    ? Just like
    DISPATCH_DATA_DESTRUCTOR_FREE
    , which does appear to be correct. Instead of
    dispatch_block_t
    it appears as
    kotlinx.cinterop.COpaquePointer?
    . I have no idea how I can use that as a dispatch block.
    o
    • 2
    • 7
  • n

    Nikita Klimenko

    10/09/2019, 12:13 PM
    Hi, seems IDE navigation isn't working starting with 1.3.60-eap-9 at least in the iosMain package.
    a
    a
    d
    • 4
    • 12
  • j

    Justin

    10/09/2019, 6:34 PM
    Anyone else get a bunch of
    IR VALIDATION
    compiler warnings for their iOS target?
    a
    • 2
    • 1
  • t

    Thomas

    10/10/2019, 5:41 PM
    Hi, I am having some difficulties with different threads in Kotlin/Native. I am creating a delegate class that I pass to some Objective C code. That delegate implements a function (https://developer.apple.com/documentation/storekit/skproductsrequestdelegate/1506070-productsrequest?language=objc) that is called from a different thread than the main thread. Because of that I cannot update some mutable state from the delegate. How can I switch to the main thread in that function and update my mutable state?
    k
    k
    • 3
    • 69
  • b

    Big Chungus

    10/12/2019, 10:52 AM
    Having a CPointer (obtained from StableRef) as an Int how can i convert it back to StableRef to dispose it?
    m
    • 2
    • 8
  • m

    Marcin Wisniowski

    10/12/2019, 6:40 PM
    Hello, I am not sure what Gradle configuration I need to cross-compile for a Raspberry Pi from my Linux host. I see some tutorials but they all seem outdated.
    • 1
    • 1
  • k

    krotki

    10/12/2019, 8:08 PM
    Hi, anybody tried to use libevent with kotlin ? I'm interested mostly in evhttp and I have some problems with creating bindings. Maybe someone already have working def file ? 😉
    d
    n
    • 3
    • 18
  • m

    Marcin Wisniowski

    10/13/2019, 12:15 AM
    How do I use a shared library from Kotlin/Native? All tutorials are for creating a shared library, not using one. I created a
    .def
    file, seems to work, I have autocompletion of library functions, project compiles, but fails when linking. I have a compiled
    .so
    file for the library, but cannot find how to make my project use it.
    n
    a
    v
    • 4
    • 11
  • m

    mben

    10/14/2019, 10:25 AM
    Hello i found out that many people raise a question about the difference between Kotlin/Native and Kotlin-multiplatform, I personally use the plugin multiplatform to target native (android/ios) I'm I doing it right or there is another plugin to use just for native target?
    k
    k
    +2
    • 5
    • 18
  • d

    deactivateduser

    10/14/2019, 11:12 AM
    Is there any POSIX method to get os type in runtime ?
    d
    o
    • 3
    • 3
  • d

    deactivateduser

    10/14/2019, 5:44 PM
    Is there any Java like version of File() in native ? Cause I made my own but can't read /etc or /var but I can read file in home folder
    s
    e
    • 3
    • 11
  • p

    Prateek Grover

    10/15/2019, 7:51 AM
    I am trying to create a mechanism for background thread execution of functions in kotlin-native for iOS platform. I am using workers to do that. I have a couple of questions about the same: 1. Since we can also use dispatch_queue in ios part of kotlin-native multiplatform project, what is then the advantage to use workers? 2. Should I create a new instance of worker for every function call or should I use a pool?
    a
    o
    +2
    • 5
    • 31
  • d

    deactivateduser

    10/15/2019, 10:30 AM
    When I add enableFeaturePreview (GRADLE_METADATA) Build error: Process 'command' java finished with non-zero exit value 1
    p
    • 2
    • 7
  • k

    Konstantin Petrukhnov

    10/15/2019, 1:42 PM
    Is there example, how to read text file on iOS (e.g. if i have some kind of filepath)?
    k
    k
    • 3
    • 7
  • p

    Prateek Grover

    10/16/2019, 7:20 AM
    What is the difference between kotlin.native.concurrent.AtomicInt and kotlinx.atomicfu.AtomicInt? I was trying to create an iOS framework using the first one and it errored with this message
    "Compilation failed: no implementation for @kotlin.native.Symbol Name public final external fun compareAndSet(expected: kotlin.Int, new: kotlin.Int): kotlin.Boolean defined in kotlin.native.concurrent.AtomicInt[DeserializedSimpleFunctionDescriptor@7f4a1cac] in deserialized class AtomicInt"
    but the second one passed. I see that there is no implementation in the class in the first case while there is one in the latter.
    e
    • 2
    • 3
  • a

    Andy Gibel

    10/17/2019, 1:19 PM
    Has anyone had the issue of using multiple K/N modules and having to combine the Klibs in a single monolithic Framework for iOS consumption? Any gotchas other than just simply exporting the
    api
    dependencies?
    m
    k
    s
    • 4
    • 11
  • s

    Sam Schilling

    10/17/2019, 4:00 PM
    I am seeing some weird behavior when producing an obj-c framework and using it in Swift. My framework
    A
    has a dependency
    B
    that is another Kotlin library that it brings in through gradle via a maven repo. In
    B
    I have a class that is structured like this:
    open class Fail(val code: IFailCode = CODE.ERROR_404) {
    
        enum class CODE(override val description: String, override val code: Int) : IFailCode {
            ERROR_404("Resource could not be found", 404),
            …
        }
        
        interface IFailCode {
            val code: Int
            val description: String
        }
    }
    The weird thing is that when I use the generated framework from
    A
    in a Swift app, I can access
    Fail
    and
    IFailCode
    , but not the enum class
    CODE
    . Also of note, they are named
    BFail
    and
    BFailIFailCode
    . Following this pattern I would expect
    CODE
    to be accessible as
    BFailCODE
    but it is not. Why wouldn’t I be able to access
    CODE
    from Swift when I can access
    Fail
    and
    IFailCode
    ? The only difference I see is that one is an enum while the other two are a class and an interface. Do these behave differently when converted to objc framework?
    k
    • 2
    • 26
  • s

    Sam Schilling

    10/18/2019, 4:03 PM
    Is native debugging planned to come to IntelliJ CE any time soon?
    ❓ 1
    m
    • 2
    • 3
  • o

    olonho

    10/18/2019, 6:45 PM
    FYI: we added https://github.com/JetBrains/kotlin-native/tree/master/samples/watchos and seriously reworked https://github.com/JetBrains/kotlin-native/tree/master/samples/uikit to show how to create pure Kotlin applications for iOS and watchOS platforms.
    👍 12
    👏 5
    r
    • 2
    • 1
Powered by Linen
Title
o

olonho

10/18/2019, 6:45 PM
FYI: we added https://github.com/JetBrains/kotlin-native/tree/master/samples/watchos and seriously reworked https://github.com/JetBrains/kotlin-native/tree/master/samples/uikit to show how to create pure Kotlin applications for iOS and watchOS platforms.
👍 12
👏 5
r

ribesg

10/21/2019, 8:25 AM
Defining UI with storyboards in pure Kotlin iOS applications is supported as well.
Isn’t that misleading? I wouldn’t call manually editing the Storyboard’s XML to use IBOutlets “supported”
View count: 5