Git Product home page Git Product logo

multiplatform-paging's Introduction

Multiplatform Paging

A library that adds additional Kotlin/Multiplatform targets to AndroidX Paging, and provides UI components to use Paging on iOS.

Introduction

As with AndroidX Paging, the primary modules of Multiplatform Paging are:

Unlike AndroidX Paging that has a limited number of targets for paging-common and makes paging-runtime Android-specific, Multiplatform Paging adds many more targets to paging-common and provides paging-runtime-uikit, a UIKit-specific runtime for iOS. Therefore, pagination logic between many more targets can be shared, and the provided UI components can be used to render the paged items on Android and iOS.

Usage

For a holistic view of Multiplatform Paging, check out the GitHub Repository Search sample project, where there's an Android, Desktop, and iOS app, along with shared pagination logic.

paging-common

The API of paging-common in Multiplatform Paging is identical to that of paging-common in AndroidX Paging (with the exception that: the namespace has changed from androidx.paging to app.cash.paging; there are some minor API discrepancies due to limitations in the Kotlin compiler). Therefore, to see how to use paging-common, consult the official documentation of AndroidX Paging.

Like AndroidX Paging, all targets except for the JVM include the Paging 3 APIs only from AndroidX Paging. There are no plans to add support for Paging 2 APIs beyond the JVM.

JVM, iOS, Linux X64, and macOS

app.cash.paging:paging-common on these targets delegate to androidx.paging:paging-common via type aliases. To understand what this means in practice, see the section Interoperability with AndroidX Paging.

JS, MinGW, Linux Arm64, tvOS, and watchOS

app.cash.paging:paging-common on these targets delegate to our fork of AndroidX Paging.

paging-compose-common

The API of paging-compose-common in Multiplatform Paging is identical to that of paging-compose in AndroidX Paging (with the exception that the namespace has changed from androidx.paging to app.cash.paging).

To see how to use paging-compose-common, consult the official documentation of AndroidX Paging.

Android

app.cash.paging:paging-compose-common on Android delegates to androidx.paging:paging-compose via type aliases. To understand what this means in practice, see the section Interoperability with AndroidX Paging.

JVM, iOS, JS, JVM, Linux X64, macOS, MinGW, tvOS, and watchOS

app.cash.paging:paging-compose-common on the these targets delegate to our fork of AndroidX Paging.

paging-runtime for Android

See the Interoperability with AndroidX Paging section below.

paging-runtime-uikit for iOS

The PagingCollectionViewController allows a PagingData to be rendered via a UICollectionView. The PagingCollectionViewController mimics the UICollectionViewController, providing: the cell count; and item retrieval via IndexPath.

Here's an example in Swift:

final class FooViewController: UICollectionViewController {

  private let delegate = Paging_runtime_uikitPagingCollectionViewController<Foo>()

  private let presenter = 

  required init(coder: NSCoder) {
    super.init(coder: coder)!
    presenter.pagingDatas
      .sink { pagingData in
        self.delegate.submitData(pagingData: pagingData, completionHandler: )
      }
  }

  override func collectionView(
    _ collectionView: UICollectionView,
    numberOfItemsInSection section: Int
  ) -> Int {
    return Int(delegate.collectionView(collectionView: collectionView, numberOfItemsInSection: Int64(section)))
  }

  override func collectionView(
    _ collectionView: UICollectionView,
    cellForItemAt indexPath: IndexPath
  ) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FooCell", for: indexPath) as! FooCell

    let item = delegate.getItem(position: Int32(indexPath.row))!
    // …

    return cell
  }
}

paging-testing

The API of paging-testing in Multiplatform Paging is identical to that of paging-testing in AndroidX Paging (with the exception that the namespace has changed from androidx.paging to app.cash.paging). Therefore, to see how to use paging-testing, consult the official documentation of AndroidX Paging.

JVM, iOS, Linux X64, and macOS

app.cash.paging:paging-testing on these targets delegate to androidx.paging:paging-testing via type aliases. To understand what this means in practice, see the section Interoperability with AndroidX Paging.

JS, MinGW, Linux Arm64, tvOS, and watchOS

app.cash.paging:paging-common on these targets delegate to our fork of AndroidX Paging.

Interoperability with AndroidX Paging

As app.cash.paging:paging-common on the JVM, iOS, Linux X64, and macOS type alias to androidx.paging:paging-common, some useful side effects occur:

  • The implementation of app.cash.paging:paging-common on the JVM, iOS, Linux X64, and macOS is identical to androidx.paging:paging-common. This means that it is impossible for there to be a behavioral discrepancy when using app.cash.paging:paging-common on the JVM, iOS, Linux X64, or macOS.
  • All libraries that depend on androidx.paging:paging-common can continue to be used. Some JVM-specific examples include androidx.paging:paging-runtime, androidx.paging:paging-compose, and androidx.paging:paging-rxjava3. This is why there aren't additional paging-runtime artifacts to support Android's UI toolkit, as you can instead depend on the official AndroidX artifact.
  • If you're already using AndroidX Paging, you don't need to refactor your existing codebase to begin using Multiplatform Paging. The use of Multiplatform Paging is only necessary if you wish to share pagination logic on targets that AndroidX Paging don't yet support, or you want to use pagination UI bindings on platforms like iOS via paging-runtime-uikit.

A similar argument can be made for app.cash.paging:paging-compose-common and app.cash.paging:paging-testing.

Releases

The versioning scheme is of the form X-Y where:

  • X is the AndroidX Paging version that is being tracked.
  • Y is the Multiplatform Paging version.

For example, if AndroidX Paging is on 3.3.0-alpha02 and Multiplatform Paging is on 0.5.1, the artifact for a release of paging-common will be app.cash.paging:paging-common:3.3.0-alpha02-0.5.1.

paging-common for common

implementation("app.cash.paging:paging-common:3.3.0-alpha02-0.5.1")

paging-compose-common for common

implementation("app.cash.paging:paging-compose-common:3.3.0-alpha02-0.5.1")

paging-runtime-uikit for iOS

implementation("app.cash.paging:paging-runtime-uikit:3.3.0-alpha02-0.5.1")

paging-testing for common

implementation("app.cash.paging:paging-testing:3.3.0-alpha02-0.5.1")

Android

Use the official AndroidX Paging dependencies.

implementation("androidx.paging:paging-runtime:3.3.0-alpha02")
implementation("androidx.paging:paging-compose:3.3.0-alpha02")
implementation("androidx.paging:paging-rxjava3:3.3.0-alpha02")
// etc.

License

Copyright 2022 Block, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

multiplatform-paging's People

Contributors

crocsandcoffee avatar jakewharton avatar renovate[bot] avatar sproctor avatar veyndan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multiplatform-paging's Issues

Usage difference between paging-compose and paging-runtime-uikit

What is the usage difference between paging-compose and paging-runtime-uikit?

I am only targeting Android and iOS using compose Multiplatform.

When I show paging data in my composable with paging-compose, I don't see any need for paging-runtime-uikit.
It works fine both on Android and iOS.

According to the documentation paging-runtime of android as well is not necessary for compose based apps, since it only holds PagingAdapter.

So it all comes down to paging-common && paging-compose for compose multiplatform app, right?

Crash on Android when calling `itemKey` with no arguments

I'm not sure if this is a bug from the AndroidX library. It only happens when calling itemKey with no arguments.

java.lang.IllegalArgumentException: Type of the key PagingPlaceholderKey(index=0) is not supported. On Android you can only use types which can be stored inside the Bundle.
        at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:78)

`PagingData.map` not found

Hey! 👋🏻

Thanks for the library :). It's super useful.

PagingData is not exposing any map function so it's quite difficult to map items inside.

Thanks! 🙇🏻

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/build.yaml
  • actions/checkout v4
  • actions/setup-java v4
  • gradle/actions v3
.github/workflows/release.yaml
  • actions/checkout v4
  • actions/setup-java v4
  • ffurrer2/extract-release-notes v2
  • ncipollo/release-action v1
gradle
gradle.properties
settings.gradle.kts
build.gradle.kts
gradle/libs.versions.toml
  • androidx.activity:activity-compose 1.8.2
  • androidx.appcompat:appcompat 1.6.1
  • androidx.compose.compiler:compiler 1.5.11
  • androidx.compose.material:material 1.6.5
  • androidx.compose.ui:ui 1.6.5
  • androidx.core:core-ktx 1.12.0
  • androidx.paging:paging-common 3.3.0-alpha02
  • androidx.paging:paging-compose 3.3.0-alpha02
  • androidx.paging:paging-runtime 3.3.0-alpha02
  • androidx.paging:paging-testing 3.3.0-alpha02
  • org.jetbrains.kotlin:kotlin-stdlib-common 1.9.23
  • org.jetbrains.kotlinx:atomicfu 0.23.2
  • org.jetbrains.kotlinx:kotlinx-coroutines-core 1.8.0
  • org.jetbrains.kotlinx:kotlinx-coroutines-android 1.8.0
  • org.jetbrains.kotlinx:kotlinx-coroutines-swing 1.8.0
  • org.jetbrains.kotlinx:kotlinx-coroutines-core-iossimulatorarm64 1.8.0
  • org.jetbrains.kotlinx:kotlinx-serialization-json 1.6.3
  • io.ktor:ktor-client-core 2.3.10
  • io.ktor:ktor-client-content-negotiation 2.3.10
  • io.ktor:ktor-client-darwin 2.3.10
  • io.ktor:ktor-client-okhttp 2.3.10
  • io.ktor:ktor-serialization-kotlinx-json 2.3.10
  • com.pinterest.ktlint:ktlint-cli 1.2.1
  • io.nlopez.compose.rules:ktlint 0.3.15
  • com.android.application 8.3.2
  • org.jetbrains.kotlin.android 1.9.23
  • org.jetbrains.compose 1.6.2
  • org.jetbrains.kotlin.multiplatform 1.9.23
  • org.jetbrains.kotlin.plugin.serialization 1.9.23
  • com.vanniktech.maven.publish.base 0.28.0
  • com.diffplug.spotless 6.25.0
paging-common/build.gradle.kts
paging-compose-common/build.gradle.kts
paging-runtime-uikit/build.gradle.kts
paging-testing/build.gradle.kts
samples/repo-search/android-composeui/build.gradle.kts
samples/repo-search/desktop-composeui/build.gradle.kts
samples/repo-search/shared/build.gradle.kts
samples/repo-search/shared-composeui/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.7

  • Check this box to trigger a request for Renovate to run again on this repository

LazyPagingItems.itemKey calls itself

This is an issue in 3.2.0-alpha05-0.2.1

Seems like the implementation from AndroidX should by copied over, but it wasn't. Calling itemKey causes a stack overflow.

LazyPagingItems.refresh has no effect

I have a PagingSource Factory in a ViewModel (Compose/Desktop) where parameters can change based on events (e.g. user changes sort order, search query, etc). I want to call LazyPagingItems.refresh() to trigger generating a new PagingSource and a call to RemoteMediator.load .

I am using this in compose:

val pager = remember(uiState.personList) {
    Pager(
        config = PagingConfig(pageSize = 20, enablePlaceholders = true, maxSize = 200),
        pagingSourceFactory = {
            Napier.d("PersonListScreen: Invoke pagingSourceFactory")
            uiState.personList()
        },
        remoteMediator = DoorRepositoryRemoteMediator(uiState.personList),
    )
}

val lazyPagingItems = pager.flow.collectAsLazyPagingItems()

LaunchedEffect(listRefreshCommand) {
    listRefreshCommand.collect {
        Napier.d("PersonListScreen: refresh lazypagingitems")
        lazyPagingItems.refresh()
    }
}

I got a log line that shows Refresh signal received (probably from PagingDataPresenter.kt). However there is no invocation of the PagingSourceFactory and no call to remotemediator.load.

This is using version 3.3.0-alpha02-0.5.1 . The project can be found here - example file PersonListScreen

Unresolved reference: LoadState

Hello even with imports:

import app.cash.paging.LoadState
import app.cash.paging.LoadState.*

LoadState.Loading , LoadState.Error and LoadState.NotLoading seems missing , would be veryuseful to be able to use it in multiplateform too

Remove dependencies from `paging-runtime-uikit` on multiplatformized `paging-runtime` classes

PagingCollectionViewController's implementation currently mimics that of PagingDataAdapter. This is conceptually convenient when comparing implementations, but I'm doubtful that anyone actually does this (including myself since implementing this).

Having the implementations mimic each other requires a fair bit of multiplatformication overhead. PagingDataAdapter exists in paging-runtime, so therefore (unsurprisingly) depends on other paging-runtime classes (like AsyncPagingDataDiffer), and these classes in turn depend on some RecyclerView classes. All these dependencies of PagingDataAdapter required multiplatformizing, as can be seen here.

Instead of having to maintain a multiplatformized fork of paging-runtime, is it possible for paging-runtime-uikit to just use classes found in paging-common? For example, depending on PagingDataDiffer (found in paging-common) instead of AsyncPagingDataDiffer (found in paging-runtime).

CC @ianhanniballake @yigit @claraf3 @dlam @swankjesse

No Such Method Error

java.lang.NoSuchMethodError: No static method items(Landroidx/compose/foundation/lazy/LazyListScope;Landroidx/paging/compose/LazyPagingItems;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;)V in class Landroidx/paging/compose/LazyPagingItemsKt; or its super classes (declaration of 'androidx.paging.compose.LazyPagingItemsKt' appears in /data/app/~~PpLbukfeRqLIYZi8syrJQQ==/in.shabinder.soundbound.preview-lgDI4qiyywYyaS4N2pBw_Q==/base.apk!classes21.dex)

I have tried Cleaning , Rebuilding and Fresh Installing the app, but the issue persists on latest: 3.2.0-alpha05-0.2.2

Type mismatch errors in the IDE

Hey, first of all, thanks for working on this, it's great to see the multiplatform ecosystem growing daily.

While integrating this library into a personal project, the IDE shows many "type mismatch" errors in the common code, I tried different combinations of Kotlin/AGP/AS and even Intellij IDEA versions, and the same happens in all of them. An example of the errors is:

Type mismatch.
Required:
app.cash.paging.PagingConfig /* = androidx.paging.PagingConfig */
Found:
app.cash.paging.PagingConfig

To investigate this, I cloned the main repo to try the sample app, and while it didn't occur when the library was imported as a project, it occurred when I updated the sample app to import the "module dependency` instead.
I also tried composite builds as an attempt to fix the issue in my project, but it didn't solve the issue.

This error looks similar to this bug report https://youtrack.jetbrains.com/issue/KT-46691/MPP-Type-mismatch-for-hierarchically-commonized-typealiases#focus=Comments-27-4921124.0-0, maybe the applied fix works only when referencing the module as a project and not as a module dependency.

Web support for paging-runtime-composeui

Currently paging-runtime-composeui doesn't support web so is there any plans to add support?
If yes, are you open to outside contribution for this?
If no, why?

WASM Support

Hey guys!

I was wondering if you are planning on releasing the library for kotlin multiplatform web with WASM as well.

kind regards

Can we use this library with Swift UI?

As per the examples, it looks like this library only supports traditional UI for iOS (and Compose for iOS), not Swift UI.
Is it planned to be supported? Any workarounds or pointers to make this work on Swift UI would be appreciated.
Thanks!

Add support for `paging-compose`

paging-compose only consists of the file LazyPagingItems.kt, and the only part that is Android specific are these lines, which are basic UI bindings to the rest of the code. The rest of the file just uses Compose and could be relocated to commonMain and shared across platforms.

Ultimately, it'd be cool to add some bindings that integrate with Compose Multiplatform, but for now just add paging-compose support would be useful for those using Compose.

Note: I mean Compose and not Compose UI.

Consider renaming `paging-runtime` to `paging-runtime-uikit`

The runtimes are specific to a target and a target UI toolkit. For the JVM you could have ones like paging-runtime-swing, paging-runtime-composeui, etc. since there are multiple toolkits and you wouldn't want to package both inside a single, multiplatform paging-runtime which targets the JVM.

Basically, same rationale for how we named Redwood artifacts.

Failed resolution of: Landroidx/paging/DifferCallback

Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.paging.DifferCallback"
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/paging/DifferCallback;
at androidx.paging.compose.LazyPagingItemsKt.collectAsLazyPagingItems(LazyPagingItems.kt:233)
at app.cash.paging.compose.LazyPagingItemsKt.collectAsLazyPagingItems(LazyPagingItems.kt:55)
[versions]
#paging
androidx-paging = "3.3.0-beta01"
cashapp-paging = "3.3.0-alpha02-0.5.1"

[libraries]
#paging
paging-runtime = { module = "androidx.paging:paging-common", version.ref = "androidx-paging" }
paging-compose = { module = "app.cash.paging:paging-compose-common", version.ref = "cashapp-paging" }

The latest known compatible version is with androidx-paging = "3.3.0-alpha02"

Clarification about how to use the experimental APIs

The library creates a new experimental annotation app.cash.paging.ExperimentalPagingApi, but when trying to use it, the compilation fails, the IDE and gradle complains:

This declaration needs opt-in. Its usage must be marked with '@androidx.paging.ExperimentalPagingApi' or '@OptIn(androidx.paging.ExperimentalPagingApi::class)'

Notice that it references to the androidx.paging annotation, I was able to solve this by adding the following to my gradle file:

sourceSets {
    all {
        languageSettings.optIn("androidx.paging.ExperimentalPagingApi")
    }
}

But I think this point needs some clarifications, it's either a bug that needs to be solved, or if it's not, then it should be pointed in the documentation.

Add new RepoSearch sample app using Android views

Unfortunately, Jetpack Compose UI hasn't completely taken over the Android world yet. In the meantime, having a sample app powered by Android views would demonstrate that there is a zero-cost migration from AndroidX Paging to Multiplatform Paging in your UI layer (because android-view wouldn't directly depend on Multiplatform Paging, and you'll continue to use the artifacts provided by AndroidX Paging). The sample will have a transitive dependency on Multiplatform Paging via the existing shared module though.

RemoteMediator is unusable right now

Unfortunately RemoteMediator isn't usable right now. The return type needs to be a RemoteMediatorMediatorResult but the sealed class has no subclasses. This means that you can't create a RemoteMediatorMediatorResultSuccess or RemoteMediatorMediatorResultError

Not able to depend on app.cash.paging:paging-runtime-composeui

I am implementing the paging in a new project android and jvm, which didnt had androidx/multiplatform paging before.

implementation("app.cash.paging:paging-runtime-composeui:3.2.0-alpha04-0.2.0")

when I have above in common.main,

:android:checkDebugDuplicateClasses always fails, with following:

Execution failed for task ':android:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class androidx.paging.compose.LazyPagingItems found in modules paging-compose-1.0.0-alpha18-runtime (androidx.paging:paging-compose:1.0.0-alpha18) and paging-compose-common-jvm-3.2.0-alpha04-0.2.0 (app.cash.paging:paging-compose-common-jvm:3.2.0-alpha04-0.2.0)
Duplicate class androidx.paging.compose.LazyPagingItems$collectLoadState$2 found in modules paging-compose-1.0.0-alpha18-runtime (androidx.paging:paging-compose:1.0.0-alpha18) and paging-compose-common-jvm-3.2.0-alpha04-0.2.0 (app.cash.paging:paging-compose-common-jvm:3.2.0-alpha04-0.2.0)
Duplicate class androidx.paging.compose.LazyPagingItems$collectPagingData$2 found in modules paging-compose-1.0.0-alpha18-runtime (androidx.paging:paging-compose:1.0.0-alpha18) and paging-compose-common-jvm-3.2.0-alpha04-0.2.0 (app.cash.paging:paging-compose-common-jvm:3.2.0-alpha04-0.2.0)
Duplicate class androidx.paging.compose.LazyPagingItems$differCallback$1 found in modules paging-compose-1.0.0-alpha18-runtime (androidx.paging:paging-compose:1.0.0-alpha18) and paging-compose-common-jvm-3.2.0-alpha04-0.2.0 (app.cash.paging:paging-compose-common-jvm:3.2.0-alpha04-0.2.0)
Duplicate class androidx.paging.compose.LazyPagingItems$pagingDataDiffer$1 found in modules paging-compose-1.0.0-alpha18-runtime (androidx.paging:paging-compose:1.0.0-alpha18) and paging-compose-common-jvm-3.2.0-alpha04-0.2.0 (app.cash.paging:paging-compose-common-jvm:3.2.0-alpha04-0.2.0)
Duplicate class androidx.paging.compose.LazyPagingItemsKt found in modules paging-compose-1.0.0-alpha18-runtime (androidx.paging:paging-compose:1.0.0-alpha18) and paging-compose-common-jvm-3.2.0-alpha04-0.2.0 (app.cash.paging:paging-compose-common-jvm:3.2.0-alpha04-0.2.0)
Duplicate class androidx.paging.compose.LazyPagingItemsKt$collectAsLazyPagingItems$1 found in modules paging-compose-1.0.0-alpha18-runtime (androidx.paging:paging-compose:1.0.0-alpha18) and paging-compose-common-jvm-3.2.0-alpha04-0.2.0 (app.cash.paging:paging-compose-common-jvm:3.2.0-alpha04-0.2.0)
Duplicate class androidx.paging.compose.LazyPagingItemsKt$collectAsLazyPagingItems$1$1 found in modules paging-compose-1.0.0-alpha18-runtime (androidx.paging:paging-compose:1.0.0-alpha18) and paging-compose-common-jvm-3.2.0-alpha04-0.2.0 (app.cash.paging:paging-compose-common-jvm:3.2.0-alpha04-0.2.0)
Duplicate class androidx.paging.compose.LazyPagingItemsKt$collectAsLazyPagingItems$2 found in modules paging-compose-1.0.0-alpha18-runtime (androidx.paging:paging-compose:1.0.0-alpha18) and paging-compose-common-jvm-3.2.0-alpha04-0.2.0 (app.cash.paging:paging-compose-common-jvm:3.2.0-alpha04-0.2.0)
Duplicate class androidx.paging.compose.LazyPagingItemsKt$collectAsLazyPagingItems$2$1 found in modules paging-compose-1.0.0-alpha18-runtime (androidx.paging:paging-compose:1.0.0-alpha18) and paging-compose-common-jvm-3.2.0-alpha04-0.2.0 (app.cash.paging:paging-compose-common-jvm:3.2.0-alpha04-0.2.0)

I can confirm if I dont have above dependency, then there is no androidx.paging:paging-compose:1.0.0-alpha18 in any of my configurations.

to confirm that I have check deps tree and also tried with :

implementation("app.cash.paging:paging-runtime-composeui:3.2.0-alpha04-0.2.0") {
    exclude("androidx.paging","paging-compose")
}

which will comile fine but will throw when run:

java.lang.NoSuchMethodError: No static method itemsIndexed(Landroidx/compose/foundation/lazy/LazyListScope;Landroidx/paging/compose/LazyPagingItems;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function5;)V in class Landroidx/paging/compose/LazyPagingItemsKt; or its super classes (declaration of 'androidx.paging.compose.LazyPagingItemsKt' appears in /data/app/~~0Zxe6wFBmBefVHkKimpSbw==/in.shabinder.soundbound-c65P7RAvXrYpTikZAK2tsg==/base.apk!classes20.dex)
                                                                                                    	at app.cash.paging.LazyPagingItemsKt.itemsIndexed(LazyPagingItems.kt:31)

which I think is expected since I dont have any thing from androidx.paging:paging-compose, and all reference will fail.

Support for ios() iosX64() architecture missing all libraries for those are not published

Hello,
I want to use this library in my project which has support for following architectures:
iosX64() iosArm64() iosSimulatorArm64()

    but this library gives error which used in my KMM project. Error stack 
    
     ```

Task :widget:compileKotlinIosSimulatorArm64 FAILED
e: Could not find "org.jetbrains.kotlin.native.platform.CoreFoundationBase" in [/Users/Documents/felix, /Users/.konan/klib, /Users/.konan/kotlin-native-prebuilt-macos-aarch64-1.7.21/klib/common, /Users/.konan/kotlin-native-prebuilt-macos-aarch64-1.7.21/klib/platform/ios_simulator_arm64]

FAILURE: Build failed with an exception.

NSInternalInconsistencyException in iOS when multiple update callbacks are triggered with single update

Scenario: Let's say I've loaded 3 pages with page size 20: (0, 20), (20, 20), (40, 20)
And now some data got updated in the database and let's say the user was on the second page then we will receive the following event in the update callback.

onRemoved: 40, 20
onChanged: 20, 20
onRemoved: 0, 20

The issue is when we receive the first event and call collectionView.deleteItems for (40, 20), the number of items will mismatch with the data source as here collection view would expect 60-20 = 40 rows but only 20 rows are available. Also, we cannot batch these operations as they are triggered individually.

Please help how I can batch these operations so that I can use something like:

collectionView.performBatchUpdates {
  collectionView.deleteItems(at: indexPath)
  collectionView.reloadItems(at: indexPath)
  collectionView.deleteItems(at: indexPath)
} 

Js browser target: Function 'collectAsLazyPagingItems' can not be called: No function found for symbol...

Describe the bug
Browser target has issue with collectAsLazyPagingItems function. Desktop, Android and OS targets works well. Browser target worked well a few month ago.

Affected platforms: Browser

Versions:

  • multiplatform-paging: 3.3.0-alpha02-0.4.0
  • Kotlin: 1.9.22
  • Compose compiler: 1.5.8
  • Compose Multiplatform: 1.6.0-dev1369
  • JDK (for desktop issues): 17

To Reproduce
Open GitHub page https://siarhei-luskanau.github.io/pixabayeye/
Or

  1. Checkout the https://github.com/siarhei-luskanau/pixabayeye
  2. Launch browser target using Gradle task :composeApp:jsBrowserDevelopmentRun
  3. Browser should be opened with browser target. You can see the next error in the browser developer console:
X_: Function 'collectAsLazyPagingItems' can not be called: No function found for symbol 'app.cash.paging.compose/collectAsLazyPagingItems|[email protected]<androidx.paging.PagingData<0:0>>(androidx.compose.runtime.Composer?;kotlin.Int){0§<kotlin.Any>}[0]' CoroutineExceptionHandlerImpl.kt:11:12
    va CoroutineExceptionHandlerImpl.kt:11
    Wo CoroutineExceptionHandlerImpl.common.kt:52
    ie CoroutineExceptionHandler.kt:32
    <anonymous> Builders.common.kt:194
    Ve JobSupport.kt:231
    is JobSupport.kt:910
    is JobSupport.kt:867
    <anonymous> JobSupport.kt:832
    <anonymous> AbstractCoroutine.kt:100
    <anonymous> Continuation.kt:54
    <anonymous> composeApp.js:1
    <anonymous> CoroutineContext.kt:60
    <anonymous> AbstractCoroutine.kt:102
    <anonymous> Continuation.kt:54
    <anonymous> composeApp.js:1
    <anonymous> Scopes.kt:32
    <anonymous> AbstractCoroutine.kt:102
    <anonymous> Continuation.kt:54
    <anonymous> composeApp.js:1
    <anonymous> Continuation.kt:54
    qC FlushCoroutineDispatcher.skiko.kt:62
    SC Synchronized.kt:24
    <anonymous> FlushCoroutineDispatcher.skiko.kt:57
    <anonymous> composeApp.js:1
    r composeApp.js:1
    <anonymous> IntrinsicsJs.kt:163
    <anonymous> Standard.kt:55
    <anonymous> composeApp.js:1
    <anonymous> Continuation.kt:45
    <anonymous> JSDispatcher.kt:131
    <anonymous> JSDispatcher.kt:59

Expected behavior
working Pagination on Browser target like Desktop, Android and OS targets

Contribute this to AndroidX?

This is great! Not sure yet if a PR back to AndroidX would be accepted but if it were to be, would you be interested in unforking this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.