• a

    Andrei Marshalov

    2 years ago
    Hello, do someone have an actual example of using
    ktor
    in multiplatform (iOS/Android) library? I’m interested in downloading files with http client. Thank you in advance!
    a
    1 replies
    Copy to Clipboard
  • Big Chungus

    Big Chungus

    2 years ago
    So I've been working on a sample project showcasing the power and sample setup for kotlin multiplatform and here it is if anyone's interested!https://gitlab.com/kotlin-examples/game-of-life-mpp It currently implements a simple GUI app for JS, WASM, Linux & Windows (possibly MacOS as well, haven't tested it yet). Feel free to submit MRs if you see room for improvements 😃
    Big Chungus
    rsetkus
    4 replies
    Copy to Clipboard
  • s

    Sylvain Patenaude

    2 years ago
    I wrote an SDK that is only comprised of static methods. At first I had those methods wrapped in objects like this:
    // File 'Name3.kt'
    package name1.name2
    
    object Name3 {
        fun Function1(): String {...}
    }
    After, I removed the "object" layer, thinking I would simplify client calls. However, when calling my Android/jvm SDK from a Java client, for instance, it looks awkward since Java doesn't support package-level functions. So it looks like this from the Java client:
    import name1.name2.Name3Kt;
    
    void func() {
        String s = Name3Kt.Function1();
    }
    Based on that, shouldn't I revert to my 1st solution of having my static functions wrapped in an object, so the client call (in Java) would look like this instead?
    import name1.name2.Name3Kt; //SDK functions at package-level
    import name1.name2.Name3;     //SDK functions at object-level
    
    String s = Name3Kt.Function1(); //SDK functions at package-level
    String s = Name3.Function1();     //SDK functions at object-level
    s
    Dico
    4 replies
    Copy to Clipboard
  • b

    bod

    2 years ago
    Hello, World! Does anyone know if it's possible to have a MP project that both publishes an Android library artifact (.aar), and contains an Android app sample. It appears to me that I find samples that either apply the
    com.android.library
    gradle plugin (to publish an aar artifact) or the
    com.android.application
    one (to have a sample app) - but of course you can't apply both. Ideas?
    b
    Big Chungus
    +1
    13 replies
    Copy to Clipboard
  • v

    vanniktech

    2 years ago
    On iOS I’ve got
    -Xobjc-generics
    enabled. However when trying to run a release build I get:
    cannot specialize non-generic type
    Seems like Kotlin Generics are only working for debug builds. Is there any additional config needed?
    v
    kpgalligan
    3 replies
    Copy to Clipboard
  • s

    Sam Schilling

    2 years ago
    Is there a way to make only some functions in a class platform-specific? The following gives me an error that
    baz
    must be abstract since it has no body:
    class Foo {
        fun bar() { ... }
        expect fun baz(): Boolean
    }
    s
    Dominaezzz
    +1
    4 replies
    Copy to Clipboard
  • Arkadii Ivanov

    Arkadii Ivanov

    2 years ago
    Is there a way to share test code between modules? I want test code of module "A" to use test code from module "B". Tried
    java-test-fixtures
    plugin but it does not seem to work in MPP environment.
    Arkadii Ivanov
    Kris Wong
    +1
    10 replies
    Copy to Clipboard
  • Olenyov Kirill

    Olenyov Kirill

    2 years ago
    Hi everyone, how to add “-Xobjc-generics” with cocoapods framework creating?
    Olenyov Kirill
    Kris Wong
    2 replies
    Copy to Clipboard
  • Tristan

    Tristan

    2 years ago
    Is there something like this available in kotlin?
    if #available(iOS 9.0, *) {
        // use UIStackView
    } else {
        // show sad face emoji
    }
    
    @available(iOS 9.0, *)
    func useStackView() {
        // use UIStackView
    }
    Tristan
    1 replies
    Copy to Clipboard
  • Lulu

    Lulu

    2 years ago
    I'm implementing a custom map for cache, and thinking of ways to make it grow as much as memory allows (or something similar, I just don't want to set a fixed size that could turnout to be useless). I thought of
    WeakReference
    but some of my team advised against it. Any suggestions or takes on this matter? We target JVM and Native.
    Lulu
    Dico
    2 replies
    Copy to Clipboard