title: 'lazy' may not be used on an already-lazy global
body: <p>My problem is that I need to get this specific variable to be initialized no matter what, because there's another object that depends on this variable's value</p>
  
  <p>Here's the code (<strong>I set the variable as global</strong>)</p>
  
  <pre><code>lazy var getToken = {
          if let token = keychain["token"].string {
              return token
          }
      }()
  </code></pre>
  
  <p>I'm using lazy because I need this to get initialized no matter what.</p>
  
  <p>I got this error error When I trying to put it on a global file</p>
  
  <blockquote>
    <p>'lazy' may not be used on an already-lazy global</p>
  </blockquote>
  
  <p>Here's the object that is depending on this token</p>
  
  <p><strong>Singleton Design</strong></p>
  
  <pre><code>class SocketIOManager: NSObject {
  
      static let sharedInstance = SocketIOManager()
  
      let socket: SocketIOClient!
  
      private override init() {
          super.init()
          socket = SocketIOClient(socketURL: URL(string: mainURL)!, .connectParams(["token": getToken])])
    }
  }
  </code></pre>
  
  <p>If you take a look at <code>socket =</code> at <code>"token"</code>, that's where I need the token </p>