Skip to content

2.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 01 Nov 16:41
Immutable release. Only release title and notes can be modified.
d3c1f1f

2.0.0 adds 11 new operators, makes combineLatest and merge easier to use from Kotlin, and drops functions that AndroidX Lifecycle now provides itself.

Breaking changes

  • map, switchMap and distinctUntilChanged() are removed. Import them from androidx.lifecycle instead; the calls stay the same.
  • liveData(), liveData(value) and liveData { } are renamed to emptyLiveData(), liveDataOf(value) and lazyLiveData { }, because liveData { } clashed with the AndroidX coroutine builder.
  • combineLatest and merge return LiveData<T> instead of LiveData<out T>, so casts at call sites are no longer needed.
  • The LiveData parameter of startWith is renamed from value to other. This only affects named arguments.
  • Requirements: minSdk 23 (was 14), Kotlin 2.1 (was 1.8), AndroidX Lifecycle 2.11.0 (was 2.6.2).

Behavior changes

  • take and skip throw IllegalArgumentException for a negative count.
  • buffer throws IllegalArgumentException unless count and skip are greater than zero.
  • emptyLiveData() returns a new instance on every call; liveData() returned a shared one.

New operators

  • skipUntil, with a predicate or another LiveData, and takeUntil with another LiveData
  • scan, withLatestFrom, sample, amb/ambWith, elementAt, startWith with several elements, mapNotNull, skipLast, zipWithNext

Fixes

  • skipWhile skips elements only while the predicate returns true.
  • buffer(count, skip) with skip smaller than count emits overlapping lists of count elements.
  • cast and filterIsInstance work with primitive classes such as Int::class.java.
  • combineLatest and merge accept the same source more than once.

What's Changed

  • Updates build, dependencies and CI by @musichin in #90
  • aligns Android namespace with package name by @musichin in #91
  • Uses Kover's coverage engine instead of JaCoCo by @musichin in #92
  • Makes combineLatest and merge return LiveData instead of LiveData by @musichin in #93
  • Removes map in favor of the AndroidX Lifecycle extension by @musichin in #94
  • Removes switchMap in favor of the AndroidX Lifecycle extension by @musichin in #95
  • Removes distinctUntilChanged() in favor of the AndroidX Lifecycle extension by @musichin in #96
  • Adds skipUntil to skip elements until the predicate returns true by @musichin in #97
  • Adds scan to emit running accumulations of the elements by @musichin in #98
  • Adds withLatestFrom to combine each element with the latest element of another LiveData by @musichin in #99
  • Adds takeUntil and skipUntil overloads that stop taking or skipping once another LiveData emits by @musichin in #100
  • Adds sample to emit the latest element whenever another LiveData emits by @musichin in #101
  • Adds amb and ambWith to follow whichever source emits first by @musichin in #102
  • Adds elementAt to emit only the element at a given index by @musichin in #103
  • Adds a vararg startWith to start with several elements by @musichin in #104
  • Adds mapNotNull to emit only the non-null results of a transform by @musichin in #105
  • Adds skipLast to skip the last elements by delaying each one by @musichin in #106
  • Adds zipWithNext to pair each element with the one before it by @musichin in #107
  • Improves KDoc consistency across operators by @musichin in #108
  • Renames the liveData factories to avoid a clash with AndroidX by @musichin in #109
  • Enables explicit API mode so every public declaration states its visibility by @musichin in #110
  • Improves the README for 2.0 by @musichin in #111

Full Changelog: 1.2.1...2.0.0