arkivanov / parcelize-darwin

70 stars 2 forks source link

Unable to setup for iOS #4

Open niyajali opened 3 days ago

niyajali commented 3 days ago

Hi, I've created a common parcel class for all platforms and used this library for iOS parcelize, but I'm getting the error below while running the app.

common\Parcelize.kt
expect annotation class Parcelize()

expect interface Parcelable

expect annotation class IgnoredOnParcel()
iosMain\Parcelize.kt
actual typealias Parcelize = com.arkivanov.parcelize.darwin.Parcelize

actual typealias Parcelable = com.arkivanov.parcelize.darwin.Parcelable

@Target(AnnotationTarget.PROPERTY)
@Retention(AnnotationRetention.SOURCE)
actual annotation class IgnoredOnParcel actual constructor()
build.gradle.kts

/*
 * Copyright 2024 Mifos Initiative
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 *
 * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
 */
plugins {
    alias(libs.plugins.mifospay.kmp.library)
    alias(libs.plugins.kotlin.parcelize)
    alias(libs.plugins.darwin.parcelize)
}

android {
    namespace = "org.mifospay.common"
}

kotlin {

    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64(),
    ).forEach {
        it.binaries.framework {
            export(libs.kermit.simple)
            export(libs.darwin.parcelize.runtime)
        }
    }

    sourceSets {
        commonMain.dependencies {
            implementation(libs.kotlinx.coroutines.core)
            api(libs.coil.kt)
            api(libs.coil.core)
            api(libs.coil.svg)
            api(libs.coil.network.ktor)
            api(libs.kermit.logging)
            api(libs.squareup.okio)
            api(libs.jb.kotlin.stdlib)
            api(libs.kotlinx.datetime)
        }

        androidMain.dependencies {
            implementation(libs.kotlinx.coroutines.android)
        }
        commonTest.dependencies {
            implementation(libs.kotlinx.coroutines.test)
        }
        iosMain.dependencies {
            api(libs.kermit.simple)
            api(libs.darwin.parcelize.runtime)
        }
        desktopMain.dependencies {
            implementation(libs.kotlinx.coroutines.swing)
            implementation(libs.kotlin.reflect)
        }
        jsMain.dependencies {
            api(libs.jb.kotlin.stdlib.js)
            api(libs.jb.kotlin.dom)
        }

       //  iosX64Main.get().dependsOn(iosMain.get())
       //  iosArm64Main.get().dependsOn(iosMain.get())
       //  iosSimulatorArm64Main.get().dependsOn(iosMain.get())
    }
}
 * Source files: Constants.kt, CurrencyFormatter.kt, DataState.kt, DataStateExtensions.kt, DateHelper.kt, DebugUtil.kt, FileUtils.kt, MifosDispatchers.kt, NavArgsConstants.kt, Parcelize.kt, DispatchersModule.kt, StringExtensions.kt, CurrencyFormatter.native.kt, FileUtils.native.kt, Parcelize.kt, DispatchersModule.native.kt

 * Compiler version: 2.0.21

 * Output kind: LIBRARY

Compilation failed: Required value was null.

    at com.arkivanov.parcelize.darwin.UtilsKt.require(Utils.kt:282)

    at com.arkivanov.parcelize.darwin.DefaultSymbols.<init>(Symbols.kt:139)

    at com.arkivanov.parcelize.darwin.ParcelizeGenerationExtension.generate(ParcelizeGenerationExtension.kt:14)

    at org.jetbrains.kotlin.fir.pipeline.ConvertToIrKt.applyIrGenerationExtensions(convertToIr.kt:442)

    at org.jetbrains.kotlin.fir.pipeline.Fir2IrPipeline.runActualizationPipeline(convertToIr.kt:246)

    at org.jetbrains.kotlin.fir.pipeline.Fir2IrPipeline.convertToIrAndActualize(convertToIr.kt:130)

    at org.jetbrains.kotlin.fir.pipeline.ConvertToIrKt.convertToIrAndActualize(convertToIr.kt:99)

    at org.jetbrains.kotlin.fir.pipeline.ConvertToIrKt.convertToIrAndActualize$default(convertToIr.kt:72)

Build iosApp_2024-11-25T23-24-56.txt

arkivanov commented 3 days ago

Looks like it's unable to reference kotlin.ULong. The plugin is still on Kotlin 1.9.22, but you are using 2.0.21. I think the plugin needs to be updated first, not sure if I have capacity for this at the moment. Please consider using kotlinx-serialization.