• k

    Konstantin Petrukhnov

    2 years ago
    E.g. how to read File, with provided filepath
    k
    gildor
    2 replies
    Copy to Clipboard
  • fcosta

    fcosta

    2 years ago
    I'm trying to add SwiftUI to my sample project but i can't use
    Preview
    . It crashes. Any way to workaround this? The log follows:
    fcosta
    kpgalligan
    +1
    14 replies
    Copy to Clipboard
  • Sujit

    Sujit

    2 years ago
    I've a bit of confusion with KMP build for native. I'm trying to build for iOS platforms, both sim and device (only 64 bits). So, I've it build as follows:
    val ios64 = iosArm64("ios64")
        val iosSim = iosX64("iosSim")
        val iosMain by sourceSets.creating {
            dependencies {
                implementation(kotlin(Config.ios.dependencies.stdlib))
                implementation(Config.ios.dependencies.serialization)
                implementation(Config.ios.dependencies.coroutines)
            }
        }
        val iosTest by sourceSets.creating {
            dependencies {
                implementation(kotlin(Config.ios.dependencies.stdlib))
                implementation(Config.android.dependencies.coroutinesTest)
            }
        }
        configure(listOf(ios64, iosSim)) {
            binaries.framework {
                baseName = Config.ios.frameworkName
                freeCompilerArgs.add("-Xobjc-generics")
            }
            sourceSets {
                @Suppress("UNUSED_VARIABLE")
                val ios64Main by getting {
                    dependsOn(iosMain)
                }
                @Suppress("UNUSED_VARIABLE")
                val iosSimMain by getting {
                    dependsOn(iosMain)
                }
                @Suppress("UNUSED_VARIABLE")
                val ios64Test by getting {
                    dependsOn(iosTest)
                }
                @Suppress("UNUSED_VARIABLE")
                val iosSimTest by getting {
                    dependsOn(iosTest)
                }
            }
        }
    Now, when I make a publication, it publishes two separate native components for iOS, basically, for both
    iossim
    , and
    ios64
    . What's the standard way to do this, such that I can only publish the native library called
    native
    , and no
    iossim
    ,
    ios64
    . I feel like I'm missing a link here somewhere... All the sources are in
    iosMain
    , and
    iosTest
    folders
    Sujit
    Kris Wong
    +1
    16 replies
    Copy to Clipboard
  • hhariri

    hhariri

    2 years ago
    Package Search is something we've been working on that provides amongst others things, discoverability of multiplatform packages. https://blog.jetbrains.com/idea/2019/10/introducing-package-search-eap/
    hhariri
    Fudge
    +2
    17 replies
    Copy to Clipboard
  • k

    Kenneth Andersson

    2 years ago
    Hi all, Im working on a larger project utilizing kotlin multiplatform. We have recently started an upgrade from the older plugins to the kotlin.multiplatform plugin, but we have run into a bit of a problem. Im hoping someone here can shed some light on what we are doing wrong. The problem is essentiallly that we would like to run the testcases on all our target platforms, and we have it running on all targets, except js, which sadly is the most important atm. I created a sample repository that demonstrates the problem: https://github.com/jayway/kotlin-multiplatform-js-tests-debug If you build that repository, you get an error when it tries to run the common testcases in js (it works in jvm). Does anybody have a solution? Thanks!
    k
    b
    +1
    7 replies
    Copy to Clipboard
  • f

    FranGSierra

    2 years ago
    Hello, there is any way to change the name of the headers of the binaries generated for iOS project? if my
    sharedModule
    class is
    Storage
    on iOS it's generated and called as
    StorageKT
    . There is any way to change the name programatically?
    f
    Artyom Degtyarev [JB]
    4 replies
    Copy to Clipboard
  • Zhan Huang

    Zhan Huang

    2 years ago
    I'm trying to create a shared interface for iOS and Android in kotlin multiplatform, and have this function that takes in a url. Is there a way I can make the iOS function take NSURL, but the android one take java.net.Url? Or should I just stick to String?
    Zhan Huang
    Kris Wong
    3 replies
    Copy to Clipboard
  • s

    Sylvain Patenaude

    2 years ago
    I often get confused in Kotlin MP with the notions of projects, modules, directories, especially the module one. In the context of my SDK (for Android, iOS consumers), I have a single project, but when it's time to partition the code (1-cross platform, 2-native Android, 3-native iOS), is it preferable to have 3 modules for that or 3 folders would do the job? I suspect that 3 modules are better, but not 100% sure.(The end goal is to have 2 build pipelines generating respectively .jar/.framework files.) Edit: Basically, the more general questio around that is, in the context of a Kotlin Multiplatform project, do you always structure your code/build files by modules (1 shared, 1 for each target) or do you sometimes separate with plain/regular directories? Edit 2: On 2nd thought, I think the project/module/directory nomenclature may be closer to the IDE I use (IntelliJ) than the Kotlin language itself.
    s
    Kris Wong
    5 replies
    Copy to Clipboard
  • d

    Dmitri Sh

    2 years ago
    eposting from the general channel, as no answers there- maybe better luck here - this channel looks to be the most appropriate one? A multiplatform project, android and iOS. In common code in Kotlin, I have an interface -
    interface Idea
    . When in Swift, want to have a struct implement this interface, a.k.a protocol now in the Swiftland. Get a compiler error -
    inheritance from non-protocol type 'Idea'.
    In the generated objective-c file I see this -
    __attribute__((objc_subclassing_restricted))
    . Reading on it, all objective c protocols are restricted to classes. So how I do get around this problem - or no getting around and have to use classes in Swift😥?
    d
    a
    +1
    4 replies
    Copy to Clipboard
  • a

    Alexander Minyaev

    2 years ago