Unable to setup for iOS
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)
Would you be able to provide a reproducer project?
There isn't a need for a reproducer. It's a common error that we were also experiencing. Because the user tried to switch several pages at once (from A to F implies skipping B,C,D) the pager reported a new current page during the animation, which results in the attempt of your code to sync the current page of pages navigation to the compose Pager state, cancelling the animation midway. As a result, the transition is stuck between F and D. This is the result of the attempt to do the "two-way sync" logic between pager and Pages navigation.
We should only use Pager state as the source of truth.
It doesn't support any other way as you see.
In order for me to fix the issue, I need a reproducer, so that I can verify it myself and fix.
I tried to reproduce the issue on the latest version (after update to Compose 1.8-rc01) but couldn't. Switching Child Pages from index 0 to index 4 works fine, pager animation plays nicely. Could you please try with Decompose 3.4.0-alpha01 and Compose 1.8?
nav.select(index = 4)
It also works fine with the previous version, before the update to Compose 1.8. If this issue is still reproducible after the update, a reproducer project or a code snippet would be useful.
Can you please try to set the pager's page change animation to something really slow? e.g 5 tween for 5 seconds. You should be able to call nav.select multiple times during the animation (which is what happens)
I'll try to find a way to reliably reproduce it in a few days and get back if I find anything
That's the reason I'm asking for a code snippet or reproducer. I don't understand what are the exact steps and/or code to reproduce.
You previously mentioned:
Because the user tried to switch several pages at once (from A to F implies skipping B,C,D)
So I tried simply switching pages from 0 to 4 and it worked. But now there seems to more details, like switching pages during the animation. I will wait for something I could use to reproduce the issue.
The easiest way might be using the sample app, specifically it Pages screen. You can try modifying it to reproduce the issue, and then just upload a branch to your fork and post a link here. Or post a diff here in comments.
I'll try to make a sample
@b95505017 issue still reproducible, any samples? link to your code where it happens?
I'll try to make sample recently.
Closing this for now. Feel free to reopen with a reproducer or additional info.
Repro: https://github.com/Nek-12/decompose-pager-repro