title: Swift KeyChain store custom object
body: <p>I'm trying to save something like this:</p>
  <pre><code>struct User {
      var id: String? = nil
      var name: String? = nil
      var cellPhone: String? = nil
      var email: String? = nil
  }
  </code></pre>
  <p>Into the <code>KeyChain</code>, according to my current project's guidelines, all of these data is sensitive but the email, so I'm trying to store all of these data into the <code>KeyChain</code> for this reason.</p>
  <p>Is there any way that I can store the whole object? Or should I just trust <code>CoreData</code> to store these objects? I need to store them in the device to verify if the user has already registered to skip the registration process and take them to the app's main screen.</p>
  <p>I'm using the <a href="https://github.com/jrendel/SwiftKeychainWrapper" rel="nofollow noreferrer"><code>KeyChainWrapper</code></a> methods like this one:</p>
  <pre><code>let saveSuccessful: Bool = KeychainWrapper.standard.set(&quot;Some String&quot;, forKey: &quot;myKey&quot;)
  </code></pre>
  <p>But if I pass my <code>User</code> instance, I get:</p>
  <p><code>No exact matches in call to instance method 'set'</code></p>
  <p>Which I believe is because there's no support either from the <code>KeyChainWrapper</code> or <code>KeyChain</code> itself to save a custom object into it.</p>
  <p>Been trying to find what kind of data types we can store inside <code>KeyChain</code>, maybe it's just primitives?</p>