Skip to content

0.6.0

Compare
Choose a tag to compare
@github-actions github-actions released this 08 Dec 14:08
· 280 commits to master since this release

Update dependencies

Removed

  • Remove now-unsupported targets: iosArm32, watchosX86.

viewmodel

  • MutableCreationExtras has been renamed to MutableCreationExtrasBuilder,
    and it does not inherit from CreationExtras anymore.
    Because of this, a new method
    MutableCreationExtrasBuilder.asCreationExtras() has been introduced can be used to convert
    a builder back to CreationExtras as needed.

    NOTE: buildCreationExtras and CreationExtras.edit methods are still the same as before.

    // Old version (0.5.0)
    val creationExtras: CreationExtras = MutableCreationExtras().apply {
      // ...
    }
    
    // New version (0.6.0): `MutableCreationExtras` does not inherit from `CreationExtras` anymore.
    val creationExtras: CreationExtras = MutableCreationExtrasBuilder().apply {
      // ...
    }.asCreationExtras() // <--- asCreationExtras: convert a builder back to `CreationExtras` as needed.

    More details: with Kotlin 1.9.20, an expect with default arguments are no longer
    permitted when an actual is a typealias
    (see KT-57614),
    we cannot
    use actual typealias MutableCreationExtras = androidx.lifecycle.viewmodel.MutableCreationExtras.
    So we have to use wrapper class instead.

  • Update the docs of ViewModel.viewModelScope to clarify that the scope is thread-safe
    on both Android and non-Android targets.

  • On non-Android targets

    • ViewModel.clear() method has been refactored to improve the performance.
    • Any Exception thrown from Closeable.close() will be re-thrown as RuntimeException.