curioustechizen
01/09/2024, 10:57 AMinterface Foo {
companion object {
val x = "SomeValue"
}
}
When the companion object is inside an interface then I don't see Foo.Companion
or Foo.companion.shared
.
Instead, the companion object is created at the top level, so the usage is: FooCompanion.shared
curioustechizen
01/09/2024, 1:02 PMcurioustechizen
01/09/2024, 1:52 PMsealed class Action {
data object OnCtaClicked: Action()
data class OnItemSelected(val index: Int): Action()
}
//Swift
Action.OnCtaClicked()
Action.OnItemSelected(index: 2)
curioustechizen
01/09/2024, 1:52 PMsealed interface Action {
data object OnCtaClicked: Action
data class OnItemSelected(val index: Int): Action
}
//Swift:
ActionOnCtaClicked()
ActionOnItemSelected(index: 2)