Skip to content

Instantly share code, notes, and snippets.

@harshalbhakta
Created October 15, 2020 10:11
Show Gist options
  • Save harshalbhakta/29aa1b2900ed386fb9d83db760d74558 to your computer and use it in GitHub Desktop.
Save harshalbhakta/29aa1b2900ed386fb9d83db760d74558 to your computer and use it in GitHub Desktop.
Kotlin Apply
// before
binding.nicknameText.text = binding.nicknameEdit.text
binding.nicknameEdit.visibility = View.GONE
binding.doneButton.visibility = View.GONE
binding.nicknameText.visibility = View.VISIBLE
// after
binding.apply {
nicknameText.text = nicknameEdit.text.toString()
nicknameEdit.visibility = View.GONE
doneButton.visibility = View.GONE
nicknameText.visibility = View.VISIBLE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment