Reaktive-LiveData-Interop

Additional

Language
Kotlin
Version
N/A
Created
Apr 28, 2019
Updated
May 16, 2019 (Retired)
Owner
Danny Lamarti (Lamartio)
Contributor
Danny Lamarti (Lamartio)
1
Activity
Badge
Generate
Download
Source code

Reaktive-LiveData-Interop

Interop for working with LiveData and the KMP implementation of Rx.

implementation "io.lamart.livedata:reaktive-livedata-interop:+"
fun example(owner: LifecycleOwner) {
    observableOf(1,2,3) // Creates a Reaktive Observable
        .toLiveData() // Converts it to a LiveData
        .toObservable(owner) // Converts it back to an Observable
}

observableOf(1,2,3).toLiveData(
    onError = { error -> }, // custom handler for the Observable.onError
    onNextFactory = { liveData -> (liveData::postValue) } // Default is liveData::setValue
)

License

Copyright 2019 Danny Lamarti

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.