Skip to content

Android LiveData property accessor auto generator using KSP(Kotlin Symbol Processing)

Notifications You must be signed in to change notification settings

cutehackers/StateStore

Repository files navigation

StateStore

Case 1)

interface SampleStateSpec {
  val sample: LiveData<Int>
}

@StateStore(spec = SampleStateSpec::class)
class SampleStateStore : AbsSampleStateStore {

}

@Suppress("MemberVisibilityCanBePrivate", "PropertyName")
open class AbsSampleStateStore : SampleStateSpec {
  override val sample: LiveData<Int>
    get() = _sample
  protected var _sample = MutableLiveData<Int>()
}

Case 2)

@StateStoreViewModel(parent = ParentViewModel::class, store = SampleStateSpec::class)
class RealSampleViewModel : AbsSampleViewModel {

}

open class AbsSampleViewModel : ParentViewModel(), SampleStateSpec {
  override val sample: LiveData<Int>
    get() = _sample
  protected var _sample = MutableLiveData<Int>()
}

About

Android LiveData property accessor auto generator using KSP(Kotlin Symbol Processing)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages