title: Swift - How to set a singleton to nil
body: <p>I am writing an app in swift and use a singleton to share a class object, User, across the app.
  I want to be able to set this singleton to 'nil' when the user logs out, so that when they log back in the old properties no longer exists (i.e. name, username, etc).
  I am hoping there is an easy way to just set the singleton back to nil, instead of having to set each property to nil.</p>
  
  <p>Here is my User class that is used in the app as <em>User.activeUser</em>:</p>
  
  <pre><code>class User: NSObject
  {
      class var activeUser : User? {
          struct Static {
              static let instance : User = User()
          }
          return Static.instance
      }
  }
  </code></pre>
  
  <p>How can I change this so that the below code does not give me a warning and actually nils out the singleton object:</p>
  
  <pre><code>User.activeUser = nil
  </code></pre>