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

    Sander Saelmans

    06/24/2020, 8:31 AM
    Is there a way to make documentation available to a swift/objc framework? e.g:
    /**
     * Some documentation
     *
     * blablabla
     */
    object SomeObject : SomeObjectFacade() {
       ...
    }
    • 1
    • 1
  • r

    Ragyal

    06/25/2020, 8:08 PM
    Can anyone help me fix/clean up my build.gradle? I can run the app on the simulator, but as soon as I want to test it on my iPhone, the build fails and states that a target for ios_arm64 or ios_arm32 must be present. Probably many things can be simplified there or are no longer up-to-date. I have different parts from different guides or templates, but I don't know much about gradle.
    build.gradle
    r
    • 2
    • 2
  • c

    CraftSpider

    06/26/2020, 3:22 AM
    I posted in #language-evolution and was told more Native team might see this here: I have interest in K/N reflection. If I were interested in doing work to add support for it, what would be involved in that? Is it currently blocked by technical limitations, is it not desired, or would this kind of thing be practical?
    s
    e
    • 3
    • 6
  • n

    napperley

    06/26/2020, 7:06 AM
    Trying to publish a message through AMQP via the rabbitmq-c library ( https://github.com/alanxz/rabbitmq-c ), and it looks as though the message isn't getting through (the Broker has dropped the message). The
    amqp_basic_publish
    function is returning 0 (this means the message has been successfully transmitted to the Broker). Below is the code that is being used to publish the message:
    private fun publishMessage(conn: amqp_connection_state_t?) = memScoped {
        val props = alloc<amqp_basic_properties_t>()
        with(props) {
            _flags = (AMQP_BASIC_CONTENT_TYPE_FLAG or AMQP_BASIC_DELIVERY_MODE_FLAG).toUInt()
            // TODO: Figure out how to set the AMQP content type.
    //        content_type = amqp_cstring_bytes("text/plain")
            // Persistent delivery mode.
            delivery_mode = 2.toUByte()
        }
        println("Publishing message...")
        val publishRc = amqp_basic_publish(
            state = conn,
            channel = channel,
            exchange = amqp_cstring_bytes(EXCHANGE),
            routing_key = amqp_cstring_bytes(ROUTING_KEY),
            mandatory = 0,
            immediate = 0,
            properties = props.ptr,
            body = amqp_cstring_bytes(MSG_BODY)
        )
        if (publishRc != 0) println("Cannot publish message.")
        Unit
    }
    • 1
    • 4
  • p

    Paul Woitaschek

    06/26/2020, 12:25 PM
    I'm having trouble with some ide setup using kotlin native. I created a mpp project and now consumed that from a regular android library. When I click on a class definition, it shows me only a decompiled class file and not the actual sources. And it seems that all dependencies are not propagated correctly. I.e I'm using flow in my mpp library but when I want to use functions from the library that return a flow it says that kotlin.coroutines.flow is not in my classpath. (but it is and it compiles correctly) Any hints on how to fix these issues?
    k
    l
    r
    • 4
    • 16
  • n

    napperley

    06/27/2020, 12:09 AM
    Having some issues which might be related to string encoding ( https://kotlinlang.slack.com/archives/C3SGXARS6/p1593155207088900 ) although i'm not entirely sure. What are the key things to check when dealing with a C library handling strings?
    • 1
    • 1
  • u

    Ugi

    06/27/2020, 10:31 AM
    Any hint how to get the same effect of
    .convert()
    on primitive integer/long, but in this case also applied to arrays. To be clear, something similar to this:
    val uIntOrULongArray = arrayof(15L.convert())
    • 1
    • 1
  • m

    Mananpoddarm

    06/28/2020, 4:57 AM
    Hi everyone, how to debug .dll generated by kotlin/native for windows? are the .pdb files generated?
    r
    • 2
    • 1
  • l

    Luoqiaoyou

    06/29/2020, 8:01 AM
    I have a concurrent question. Suppose I have a network IO task class with mutable state inside. Using thread pools to execute multiple network IO task instances would cause instances to be frozen in KN. If I specify a thread to each instance, the different elapsed times for each task may cause some threads to be busy and others to be idle. There is also a performance issue if you use atomic. Is there a more elegant way?
    a
    k
    • 3
    • 3
  • a

    aleksey.tomin

    07/03/2020, 8:02 AM
    Hello I try to use wlanapi for mingw 1. Make wlanapi.def
    package = wlanapi
    headers = wlanapi.h
    headerFilter = wlanapi.h
    2. Add to gradle build file
    mingwX64("mingw") {
            compilations["main"].cinterops.create("wlanapi")
        }
    On gradlew I have error:
    > Task :sdk:cinteropWlanapiMingw
    Exception in thread "main" java.lang.Error: C:\Users\alxt\.konan\dependencies\msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1\x86_64-w64-mingw32\include\ntddndis.h:99:11: error: unknown type name 'ULONG
            at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152)
            at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.indexDeclarations(Indexer.kt:1003)
            at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.buildNativeIndexImpl(Indexer.kt:992)
            at org.jetbrains.kotlin.native.interop.indexer.NativeIndexKt.buildNativeIndex(NativeIndex.kt:91)
            at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:230)
            at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:46)
            at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:44)
            at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:19)
            at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:37)
    gradlew --version                                                                                                                                                               
    ------------------------------------------------------------
    Gradle 6.5.1
    ------------------------------------------------------------
    
    Build time:   2020-06-30 06:32:47 UTC
    Revision:     66bc713f7169626a7f0134bf452abde51550ea0a
    
    Kotlin:       1.3.72
    Groovy:       2.5.11
    Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
    JVM:          11.0.7 (<http://Amazon.com|Amazon.com> Inc. 11.0.7+10-LTS)
    OS:           Windows 10 10.0 amd64
    kotlin: 1*.3.72* What can I do to fix it?
    a
    m
    • 3
    • 8
  • w

    willyrs

    07/03/2020, 5:57 PM
    Hi all! Are you supposed to not store function in variables when using kotlin-native? I’ve written a reducer function for reduxkotlin like this:
    val splashReducer: Reducer<SplashState> =  { state, action -> return state }
    and when I call it I have a EXC_BAD_ACCESS (code=1, address=0x0) error If I write the function like this:
    fun splashReducer(state: SplashState, action: Any) : SplashState { return state }
    it works! Do you think it’s a problem with reduxkotlin or with kotlin-native? P.S. On kotlin-android it works with both
    a
    • 2
    • 2
  • t

    tylerwilson

    07/03/2020, 8:10 PM
    Any clue on what this might mean:
    /Users/teamcity3/buildAgent/work/4d622a065c544371/runtime/src/main/cpp/ObjCExport.mm:345: runtime assert: Unable to add 'toKotlin:' method to NSBlock class
    I get this when accessing Kotlin/Native code from Objective-C and having a Swift Framework wrapper also present. Calling from Swift there is no issue.
    s
    • 2
    • 2
  • p

    Piasy

    07/04/2020, 9:34 AM
    Hi guys, I want to debug an issue related to Kotlin/Native on iOS, so I want to use local built KN in my gradle multiplatform project, is there any guide about how to do this? Thank you!
    s
    • 2
    • 6
  • i

    Iaroslav Postovalov

    07/05/2020, 4:53 PM
    Hello! How can I debug definitions? For example, these ones can't be linked.
    • 1
    • 1
  • n

    napperley

    07/05/2020, 11:10 PM
    It appears as though the cinterop tool has generated incorrect mappings for the rabbitmq-c library ( https://github.com/alanxz/rabbitmq-c ). Trying to set the content_type field on a instance of amqp_basic_properties_t, based on the amqp_sendstring sample ( https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_sendstring.c#L89 ). However the content_type field is read only instead of being writable.
    k
    s
    • 3
    • 6
  • n

    napperley

    07/06/2020, 3:31 AM
    Memory usage (RES) for the program I have developed (sunny_island_telemetry) is in good shape (holding steady at around 11.3 MB), which is impressive considering that Kotlin Native hasn't been heavily optimised for performance:
    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND     
     1682 telemet+  20   0  113.0m  11.2m   3.3m S   0.0  0.3  63:40.01 node_expor+
     5342 telemet+  20   0  111.9m  11.3m   9.0m S   0.0  0.3   0:04.35 sunny_isla+
    By contrast node_exporter (a program written in Go - https://github.com/prometheus/node_exporter ) is using a similar amount of memory (around 11.2 MB). Unfortunately the Ktor Client library (the Kotlin Native version) can't be used by sunny_island_telemetry since it has the nasty habit of leaking memory badly, therefore the libcurl library is used to keep memory usage under control.
    • 1
    • 1
  • a

    aleksey.tomin

    07/06/2020, 10:30 AM
    I try to use Windows WLan interface
    private fun ensureSuccess(result: UInt) {
            require(result.toInt() == ERROR_SUCCESS) { "WinApi error: $result"}
        }
    ...
        memScoped {
            val phClientHandle = alloc<HANDLEVar>()
            val version = alloc<DWORDVar>()
            ensureSuccess(WlanOpenHandle(2, null, version.ptr, phClientHandle.ptr))
            val ifsList = nativeHeap.allocArray<PWLAN_INTERFACE_INFO_LISTVar>(10)
            ensureSuccess(WlanEnumInterfaces(phClientHandle.ptr, null, ifsList))
        }
    The second call returns 6
    ERROR_INVALID_HANDLE
    What am I doing wrong?
    s
    • 2
    • 2
  • i

    Iaroslav Postovalov

    07/07/2020, 8:42 AM
    How can I call C function that accepts
    va_list
    ?
    d
    • 2
    • 1
  • a

    aleksey.tomin

    07/07/2020, 12:51 PM
    How can I parse XML in KN? 1. Can I use
    org.jetbrains.kotlinx:kotlinx-serialization
    ? 2. I’ve found example for OSX but can’t understand how convert it to kotlin: https://stackoverflow.com/questions/21791702/nsxmlparser-simple-example 3. And how can I override this methods:
    @kotlinx.cinterop.ExternalObjCClass public interface NSXMLParserDelegateProtocol : platform.darwin.NSObjectProtocol {
        @kotlinx.cinterop.ObjCMethod public open fun parser(parser: platform.Foundation.NSXMLParser, didEndMappingPrefix: kotlin.String): kotlin.Unit { /* compiled code */ }
    
        @kotlinx.cinterop.ObjCMethod public open fun parser(parser: platform.Foundation.NSXMLParser, foundCharacters: kotlin.String): kotlin.Unit { /* compiled code */ }
    ...
    s
    • 2
    • 3
  • a

    aleksey.tomin

    07/08/2020, 6:18 AM
    I misunderstood with windows C interopt 😞 C code:
    PWLAN_INTERFACE_INFO_LIST pIfList = NULL;
    WlanEnumInterfaces(hClient, NULL, &pIfList);
    for (i = 0; i < (int) pIfList->dwNumberOfItems; i++) {
        PWLAN_INTERFACE_INFO pIfInfo = (WLAN_INTERFACE_INFO *) &pIfList->InterfaceInfo[i];
    How can I convert this code to kotlin?
    memScoped {
        val zeroValue: CValue<PWLAN_INTERFACE_INFO_LISTVar> = zeroValue()
        val ppInterfaceList: CPointer<CPointerVarOf<CPointer<_WLAN_INTERFACE_INFO_LIST>>> = zeroValue.getPointer(memScope)
        WlanEnumInterfaces(wlanHandle, null, ppInterfaceList)
        val pInterfaceList: CPointerVarOf<PWLAN_INTERFACE_INFO_LIST> = ppInterfaceList.pointed
        val interfaceList: PWLAN_INTERFACE_INFO_LIST? = pInterfaceList.value
        val wlanIfsInfoList: _WLAN_INTERFACE_INFO_LIST? = interfaceList?.pointed
        for (pIfInfo ????????)
    }
    • 1
    • 1
  • j

    Jamie Craane

    07/08/2020, 2:21 PM
    Will Kotlin Native in a future version support incremental compilation? One of the drawbacks at the moment is long compilation times when projects get bigger. We have some work arounds for it but a performance increase in compilation speed is a welcome addition.
    b
    s
    • 3
    • 2
  • p

    Piasy

    07/12/2020, 12:12 PM
    Hi guys, I'm fighting with a KN runtime abort issue, the abort code is in
    freezeSubgraph
    function of
    Memory.cpp
    :
    #if USE_GC
      // Now remove frozen objects from the toFree list.
      // TODO: optimize it by keeping ignored (i.e. freshly frozen) objects in the set,
      // and use it when analyzing toFree during collection.
      auto state = memoryState;
      for (auto& container : *(state->toFree)) {
        if (!isMarkedAsRemoved(container) && container->frozen()) {
          RuntimeAssert(newlyFrozen.count(container) != 0, "Must be newly frozen");  // <=== here
          container = markAsRemoved(container);
        }
      }
    #endif
    The abort seems happen randomly, I really don't know what's wrong with my code. I tried to comment this line, it seems work fine, I'd like to know what's the possible problem if this condition is false? Would there be other problem if I comment this code? Thank you! I really need your help, genius at JB!
    a
    s
    • 3
    • 9
  • n

    napperley

    07/13/2020, 4:35 AM
    Encountering strange behaviour where the HTTP server isn't always responding with the right body in the response. What might cause the strange behaviour to occur? The sample project can be found here: https://gitlab.com/napperley/http-server
    • 1
    • 2
  • a

    aleksey.tomin

    07/14/2020, 9:26 AM
    I try to use windows location manager and write the code (error checks exists by skiped):
    val pSensorManager = zeroValue<ISensorManager>().getPointer(memScope)
                CoCreateInstance(CLSID_SensorManager.ptr, null, CLSCTX_INPROC_SERVER.toUInt(), IID_ISensorManager.ptr, pSensorManager.reinterpret())
                pSensorManager.pointed.lpVtbl?.pointed?.let { sensorManagerVtbl: ISensorManagerVtbl ->
                    println("----AddRef: ${sensorManagerVtbl.AddRef?.rawValue}") // looks like a ref: 0x7ffebe937468
                    println("----GetSensorsByCategory: ${sensorManagerVtbl.GetSensorsByCategory?.rawValue}") // looks like a ref: 0x-45520ff300000000
                    println("----GetSensorsByType: ${sensorManagerVtbl.GetSensorsByType?.rawValue}") // look like error: 0x-1
                    sensorManagerVtbl.AddRef?.invoke(pSensorManager) // Error: User-mode data execution prevention (DEP) violation at location 0x7ffebe937468
                    sensorManagerVtbl.GetSensorsByCategory?.invoke(pSensorManager, SENSOR_CATEGORY_LOCATION.ptr, pSensorCollection) // The same error
    What do I wrong?
    • 1
    • 3
  • m

    Madhava

    07/15/2020, 12:26 AM
    Does anyone know where the best place is to find discussion and information about Rust <-> JVM language FFI interop?
    t
    l
    • 3
    • 6
  • z

    zsperske

    07/16/2020, 12:48 AM
    Hey everyone, general question about using
    cinterop
    for an iOS target. Besides the kotlin official docs, does anyone know of a good github example or blog post that details how to go about pulling a
    .framework
    into your
    iOSMain
    kotlin code?
    j
    k
    • 3
    • 7
  • a

    aleksey.tomin

    07/17/2020, 6:06 AM
    Hello I try to use microhttpd (like https://github.com/Kotlin/kotlinconf-spinner/blob/master/httpserver/src/hostMain/kotlin/server/HttpServer.kt) for localhost only (https://stackoverflow.com/questions/46023399/make-local-http-server-inaccessable-from-outside). On macOS
    val portShort = 8888.toUShort()
            val loopbackAddr = alloc<sockaddr_in>()
            loopbackAddr.sin_addr.s_addr = INADDR_LOOPBACK
            loopbackAddr.sin_family = AF_INET.convert()
            loopbackAddr.sin_port = portShort
    ...
            val daemon = MHD_start_daemon(
                MHD_USE_POLL_INTERNALLY,
                portShort,
                null,
                null,
                staticCFunction(::processRequest), cPointer,
                MHD_OPTION_SOCK_ADDR, loopbackAddr.ptr,
                MHD_OPTION_END
            )
    If I remove
    MHD_OPTION_SOCK_ADDR, loopbackAddr.ptr
    - it works. But with this option daemon is null. What do I wrong?
    a
    • 2
    • 4
  • p

    phldavies

    07/17/2020, 12:30 PM
    Is there any way to get a format a kotlin String from
    msg: CPointer<ByteVar>?, args: va_list?
    ? I’m attempt to pass
    staticCFunction { _: COpaquePointer?, msg: CPointer<ByteVar>?, args: va_list? -> }
    to an API but I’m not sure how to make use of the parameters.
    a
    d
    • 3
    • 3
  • u

    ursus

    07/18/2020, 5:18 AM
    How do you guys do DI? Manually with by lazy?
    w
    a
    +3
    • 6
    • 12
  • p

    Paul Woitaschek

    07/18/2020, 8:25 AM
    Dagger for Android and a manual service locator for iOS
    u
    • 2
    • 3
Powered by Linen
Title
p

Paul Woitaschek

07/18/2020, 8:25 AM
Dagger for Android and a manual service locator for iOS
u

ursus

07/18/2020, 8:34 PM
means shared code has no notion of DI, only the implementing app?
p

Paul Woitaschek

07/20/2020, 12:08 PM
Yes, yet the ios service locator is based in the iosMain module and the dagger module is implemented in main android app
u

ursus

07/20/2020, 3:01 PM
How is that working for you? I'm toying with that idea. However often "module owner" knows best how to scope dependencies for a given module, and it kind of makes sense to have di module definitions in a given module, but it also limits reusability if you want to say change scope ..so..im not sure
View count: 11