Skip to content

Instantly share code, notes, and snippets.

@sliskiCode
Last active December 15, 2017 09:45
Show Gist options
  • Save sliskiCode/ecfc14f9661dcf0afd57b195bb2a2171 to your computer and use it in GitHub Desktop.
Save sliskiCode/ecfc14f9661dcf0afd57b195bb2a2171 to your computer and use it in GitHub Desktop.
6 magic sugars that can make your Kotlin codebase happier #22
interface ComponentInterface {
val onNavigationClick: (() -> Unit)?
var searchText: String
}
class Component : ComponentInterface {
private val navigable: Navigable = NavigableImpl()
private val searchable: Searchable = SearchableImpl()
override val onNavigationClick: (() -> Unit)?
get() = navigable.onNavigationClick
override var searchText: String = ""
get() = searchable.searchText
set(value) {
field = value
searchable.searchText = value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment