Crash when attempting to save a String to UserDefaults in Swift : <p>I am using this line of code to save a String to UserDefaults,</p>

<pre><code>UserDefaults.standard.set(userSelected, forKey: "myKeyString")
</code></pre>

<p>However it results in the crash,</p>

<pre><code>[User Defaults] Attempt to set a non-property-list object (Function) as an NSUserDefaults/CFPreferences value for key myKeyString
</code></pre>

<p>Why?</p>
