I remember that in kotlin language there is a option to get value by get() property, but can't find how to write it.
What I mean is: I have a LiveData into my ViewModel and I need that access to post in LiveData has only ViewModel and outside just option to get for subscribe.
How I implemented it for now is
class MyViewModel(ctx: Context) : AndroidViewModel(ctx as Application)
{
private val _showLoadingPB = SingleLiveEvent<Boolean>()
fun showLoadingPB(): SingleLiveEvent<Boolean>
{
return _showLoadingPB
}
...
}
But I remember that there is an option to write it like this
class MyViewModel(ctx: Context) : AndroidViewModel(ctx as Application)
{
private val _showLoadingPB = SingleLiveEvent<Boolean>()
val showLoadingPB: SingleLiveEvent<Boolean>
get() => _showLoadingPB
}
How to make it works?