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

    khairil.ushan

    04/30/2018, 3:19 PM
    So I'm trying to convert a NSData to NSString, in Obj-C I can do it like this
    NSString *newStr = [NSString stringWithUTF8String:[data bytes]];
    So i tried that in K/N like this
    val newStr = NSString.stringWithUTF8String(data!!.bytes!!)
    But I got this error message
    Error:(21, 55) type mismatch: inferred type is COpaquePointer? /* = CPointer<out CPointed>? */ but CPointer<ByteVar /* = ByteVarOf<Byte> */>? was expected
    So what've I missed here? Thanks. 🙂
    s
    5 replies · 2 participants
  • a

    albertgao

    05/01/2018, 12:46 AM
    Will KN love this code?
    val name = this::class.qualifiedName
    Just a little reflection
    o
    1 reply · 2 participants
  • e

    el_tigro

    05/01/2018, 5:47 AM
    Hi, I was wondering if I could get some clarification on something that confused me in https://kotlinlang.org/docs/reference/native-overview.html
    [Kotlin/Native] comprises a LLVM-based backend for the Kotlin compiler and a native implementation of the Kotlin runtime library
    "backend" in this context does not mean an actual LLVM backend (which consumes IR to produce machine code). Instead it is backend for the Kotlin compiler itself. So
    (Kotlin compiler + "backend") = LLVM frontend
    . is this correct?
    a
    o
    3 replies · 3 participants
  • y

    yusuf3000

    05/01/2018, 8:52 AM
    I’m trying to download K/N 0.7 via gradle, but I get an exception:
    A problem occurred evaluating project ':platform-ios'.
    > org/gradle/api/internal/FeaturePreviews
    Is this something I’m doing wrong?
    s
    3 replies · 2 participants
  • s

    se1by

    05/01/2018, 10:41 AM
    hey, I was wondering if there is a way to load a kotlin native library as a dynamic lib? or do I have to generate a dynamic C lib and load that? I basically just want to load & use a lib at runtime
    o
    4 replies · 2 participants
  • d

    drofwarcs

    05/03/2018, 1:21 AM
    It seems like the build fails before the run script can execute
    s
    2 replies · 2 participants
  • s

    spierce7

    05/05/2018, 4:06 AM
    is any sort of reflection planned for kotlin/native?
    o
    m
    5 replies · 3 participants
  • o

    olonho

    05/05/2018, 9:34 AM
    @channel myself and @svyatoslav.scherbina will be at Google IO in Moutain View this year, so feel free to come and chat with us (@abreslav and @Alexander Podkhalyuzin [JB] will be there as well)
    :android: 3
    :google: 1
    :kotlin-flag: 6
    s
    g
    3 replies · 3 participants
  • a

    adev_one

    05/05/2018, 11:28 AM
    In which
    .gradle
    file should be
    apply plugin: 'kotlin'
    apply plugin: 'konan'
    
    konan.targets = [
        'ios_arm64', 'ios_x64'
    ]
    
    konanArtifacts {
        framework('KotlinNativeFramework')
    }
    when build multimodule project?
    o
    7 replies · 2 participants
  • d

    drofwarcs

    05/08/2018, 12:04 AM
    Anyway to force the Kotlin Native plugin for Appcode to download 0.7.0 version of KN? Running the gradle script downloads the right version(0.7.0) but when I open a KN project in Appcode, it always download 0.6.2 if its not already downloaded.
    v
    2 replies · 2 participants
  • m

    molikto

    05/08/2018, 8:11 AM
    it seems there is some bug relating init in companion objects. I have a anonymous class extending a class with a init companion object, it is not working (using a workaround now)
    o
    1 reply · 2 participants
  • m

    molikto

    05/10/2018, 1:34 PM
    why access a property will trigger seg fault?
    s
    1 reply · 2 participants
  • l

    Lucas

    05/12/2018, 12:49 AM
    Is it recommended to write DSLs for C bindings or it can cause problems with low-level operations like pointers, memory management, etc? The GTK sample from KN repository, for example, uses functions like
    gtk_window_set_title
    and
    gtk_button_new_with_label
    which is not similar to how JVM code is written.
    o
    2 replies · 2 participants
  • a

    albertgao

    05/14/2018, 2:54 AM
    Errors when
    apply plugin: 'konan'
    version = 0.7
    Caused by: java.lang.NoClassDefFoundError: org/gradle/api/internal/FeaturePreviews
    	at org.jetbrains.kotlin.gradle.plugin.KonanPlugin.apply(KonanPlugin.kt:351)
    	at org.jetbrains.kotlin.gradle.plugin.KonanPlugin.apply(KonanPlugin.kt:269)
    	at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:41)
    	at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:49)
    What am i missing?
    s
    1 reply · 2 participants
  • a

    albertgao

    05/14/2018, 4:42 AM
    Having a problem. I have a project set up in IDEA (
    common
    , and
    android
    for android lib, and
    ios
    for ios framework), but when I open this project in AppCode, nothing shows in the
    Project
    panel… I assume it might be something to do with the
    .idea
    folder between IDEA and AppCode is different. So, in order to make the multiplatform works for iOS, I need to create the projects in AppCode from scratch?
    o
    v
    +2
    24 replies · 5 participants
  • r

    rrader

    05/14/2018, 2:46 PM
    https://github.com/frol/completely-unscientific-benchmarks
    o
    1 reply · 2 participants
  • d

    damian

    05/15/2018, 1:47 AM
    what are the current thoughts on how [companion] objects will be represented in ObjC? I remember hearing some discussion that these interop APIs will probably change, but I'm curious what the candidates look like (if there are yet any)
    o
    1 reply · 2 participants
  • a

    albertgao

    05/15/2018, 4:06 AM
    In terms of iOS:
    fun checkInt(value:Int): String = "number: $value"
    It works. when you
    print(checkInt(6))
    at the swift side, it will print
    number: 6
    But this won’t work
    fun <T> checkGeneric(value: T):String = when (value) {
              is String -> "string"
              is Int -> "number"
              is Boolean -> "boolean"
              else -> "Unknown"
      }
    String
    and
    Boolean
    type works fine, but
    print(checkGeneric(6))
    will output
    Unknown
    . So, the generic is partially supported?
    g
    5 replies · 2 participants
  • p

    ptmt

    05/15/2018, 1:07 PM
    class KotlinView1  {
    }
    
    class KotlinView2 : UIView {
       @OverrideInit constructor(coder: NSCoder) : super(coder)
    }
    
    @ExportObjCClass
    class KotlinView3 : UIView {
       @OverrideInit constructor(coder: NSCoder) : super(coder)
    }
    After compiling this as a framework artifact, I see only
    @class KotlinView1
    in a header file. Is this use case not supported or am I doing something wrong?
    s
    2 replies · 2 participants
  • n

    nish

    05/15/2018, 4:49 PM
    I don’t know if this has been asked before, but how mature is the KN - Javascript interop on the WebAssembly front?
    g
    6 replies · 2 participants
  • a

    albertgao

    05/15/2018, 10:54 PM
    So, KN requires a gradle versoin > 4.6 now, but Android gradle plugin has a different idea, they need a version less than 4.6, causes trouble for a multiplatform project when building Android lib:
    > Failed to apply plugin [id 'com.android.library']
       > Configuration on demand is not supported by the current version of the Android Gradle plugin since you are using Gradle version 4.6 or above. Suggestion: disable configuration on demand by setting org.gradle.configureondemand=false in your gradle.properties file or use a Gradle version less than 4.6.
    Anyone has this issue? Even I set that to
    false
    , Android gradle plugin still gives the same error
    g
    g
    9 replies · 3 participants
  • k

    Konstantin Petrukhnov

    05/17/2018, 4:05 AM
    In swift I have array with data: [Uint8]. In kotlin i have class that should process that data. What kotlin type i should use, that could hold this value? List<Byte> gives [NSNumber], but it will create new object. I wonder if i could avoid creating new objects.
    a
    s
    +1
    8 replies · 4 participants
  • s

    sksk

    05/17/2018, 5:00 PM
    Looks like the clion team made progress with gradle: https://blog.jetbrains.com/clion/2018/05/clion-starts-2018-2-eap-sanitizers-gradle-db-performance/#gradle_cpp_projects #hype!! 😄
    🎉 4
    v
    s
    4 replies · 3 participants
  • a

    adev_one

    05/19/2018, 12:24 AM
    When I'm trying to implement kotlin interface in swift my app crashes:
    Unrecognized selector -[ios.IosApiRequestsMaker toKotlin:]
    2018-05-19 05:15:48.277185+0500 ios[47861:1486398] Unrecognized selector -[ios.IosApiRequestsMaker toKotlin:]
    Is there way to fix it?
    o
    y
    +1
    7 replies · 4 participants
  • r

    russhwolf

    05/20/2018, 5:36 AM
    The 0.7 changelog includes the item: “Use Gradle native dependency model, allowing to use .klib as Maven artifacts” Does this mean I can publish a klib to a repository like jitpack or bintray and consume it in another project? If so, how can I configure this via the gradle plugin?
    m
    o
    +1
    8 replies · 4 participants
  • s

    sdeleuze

    05/20/2018, 5:59 PM
    I think at some point somebody shared a Gradle multiplatform sample repo including JVM and Native support but I can't find the GitHub repo again. Can somebody share the link again?
    r
    2 replies · 2 participants
  • s

    sdeleuze

    05/20/2018, 6:30 PM
    Also is it possible to build a WebAssembly app like html5Canvas with Gradle or is there some current blocking points ?
    a
    2 replies · 2 participants
  • y

    yusuf3000

    05/21/2018, 6:42 AM
    I need to make a method in my kotlin common code synchronised. What would be the best way to do this considering kotlin common doesn’t have this keyword? This method is being called from swift/kotlin. Should the methods that call into the kotlin common code be synchronised instead?
    g
    o
    5 replies · 3 participants
  • m

    msink

    05/21/2018, 8:46 AM
    My second attempt to develop cross-platform desktop GUI applications: https://github.com/msink/kotlin-libui
    👍 9
    l
    3 replies · 2 participants
  • d

    drofwarcs

    05/23/2018, 3:42 PM
    Is there a way to tell the kotlin compiler where an existing (non-kotlin) iOS framework is at? I successfully got the c_interop tool to build iOS stubs but getting an Undefined Symbol error when I got to build. Also, I alredy embedded/linked the same framework into the Xcode project
    o
    2 replies · 2 participants
Powered by Linen
Title
d

drofwarcs

05/23/2018, 3:42 PM
Is there a way to tell the kotlin compiler where an existing (non-kotlin) iOS framework is at? I successfully got the c_interop tool to build iOS stubs but getting an Undefined Symbol error when I got to build. Also, I alredy embedded/linked the same framework into the Xcode project
o

olonho

05/23/2018, 4:31 PM
likely you need to add
linkerOpts
.def statement or
-linkerOpts
cinterop tool switch to inform cinterop tool about which framework to link in
d

drofwarcs

05/23/2018, 5:55 PM
Thx
View count: 5