title: iOS Swift UserDefaults equivalent in Android Kotlin
body: <p>I'm used to writing iOS apps in Swift, and using UserDefaults to safe state. How do I do something similar in Android using Kotlin?</p>
  <p>For example, here's how I would set the user's data and login state in Swift.</p>
  <pre class="lang-swift prettyprint-override"><code>// Swift example; how is this possible with Kotlin?
  UserDefaults.standard.set(value, forKey: MyKeys.userid.rawValue)
  UserDefaults.standard.synchronize()
  </code></pre>