title: Singleton class for sharing data
body: <p>I'm an android app developer and a beginner in swift. I'm trying to implement a singleton class whose data members are shared throughout the app (like Settings). 
  Getting this done in android is pretty simple but I'm breaking my head to do it in swift.</p>
  
  <p>Below is the code I've tried ..</p>
  
  <pre><code>public class DataSet
  {
      public var notificationOnOff: Bool!
      public var interval: Int!
      public var alert: String!
  
      init()
      {
          self.notificationOnOff = true
          self.interval = 1;
          self.alert = nil;
      }
  
      init (onOff: Bool) {
          self.notificationOnOff = onOff
      }
  
      init (time: Int) {
          self.interval = time
      }
  
      init (stop: String) {
          self.alert = stop
      }
  }
  </code></pre>
  
  <p>This class implementation couldn't persist the data.
  Is this the right way of doing it?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>For example, when I click switch in Settings view controller, I'm setting notificationOnOff like ..</p>
  
  <pre><code>dataset.notificationOnOff = DataSet(onOff: true) // value is set and able to print it
  </code></pre>
  
  <p>and using this value in another class like...</p>
  
  <pre><code>if dataset.notificationOnOff
  {
   // do some stuff
  }
  </code></pre>
  
  <p>So basically, the value is persisting only within the Setting class but not when I switch to other class.</p>