Skip to content

Instantly share code, notes, and snippets.

@krupalshah
Created June 4, 2017 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krupalshah/9a007958debd4e25fcc8ea50b5c737c9 to your computer and use it in GitHub Desktop.
Save krupalshah/9a007958debd4e25fcc8ea50b5c737c9 to your computer and use it in GitHub Desktop.
helper for shared prefs - kotlin version - Refactoring step 3
inline fun SharedPreferences.edit(operation: (SharedPreferences.Editor) -> Unit) {
val editor = this.edit()
operation(editor)
editor.apply()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment