livedata fun kotlin code example
Example: how to initialize livedata kotlin
fun <T : Any?> MutableLiveData<T>.default(initialValue: T) = apply { setValue(initialValue) }
val liveData = MutableLiveData<String>().default("Initial value!")
fun <T : Any?> MutableLiveData<T>.default(initialValue: T) = apply { setValue(initialValue) }
val liveData = MutableLiveData<String>().default("Initial value!")