diff --git a/mvrx/src/main/kotlin/com/airbnb/mvrx/MvRxView.kt b/mvrx/src/main/kotlin/com/airbnb/mvrx/MvRxView.kt index 331e7539a..ae8858ecb 100644 --- a/mvrx/src/main/kotlin/com/airbnb/mvrx/MvRxView.kt +++ b/mvrx/src/main/kotlin/com/airbnb/mvrx/MvRxView.kt @@ -45,7 +45,13 @@ interface MvRxView : MvRxViewModelStoreOwner, LifecycleOwner { * the fragment's lifecycle owner so that the subscriptions are cleared in `onDestroy`. Subscriptions made in or after * `onCreateView` should use the fragment's _view's_ lifecycle owner so that they are cleared in `onDestroyView`. * - * By default this is the same as the view's standard lifecycle owner. + * For example, if you are using a fragment as a MvRxView the proper implementation is: + * ``` + * override val subscriptionLifecycleOwner: LifecycleOwner + * get() = this.viewLifecycleOwnerLiveData.value ?: this + * ``` + * + * By default [subscriptionLifecycleOwner] is the same as the MvRxView's standard lifecycle owner. */ val subscriptionLifecycleOwner : LifecycleOwner get() = this