title: Swift: Instance member cannot be used on type
body: <p>I'm trying to call a variable from my <code>Users</code> class in <code>Data</code> class but I'm thrown this error</p>
  
  <blockquote>
    <p>Instance member 'user' cannot be used on type 'Data'</p>
  </blockquote>
  
  <p><code>Data</code> class code:</p>
  
  <pre><code>import Foundation
  
  class Data {
  
     static let sharedInstance = Data()
  
     let user = Users()
     var id = (user.userId).string
  
     //Login.swift
     static let quarterlyEndpoint: String = "http://anyapi/api/users/\(id)/quarterly/tasks"
  
  // for prevent from creating this class object
  private init() { }
  
  }
  </code></pre>
  
  <p><code>Users</code> class code:</p>
  
  <pre><code>var userId: Int {
  
      guard let  _userId = getId() else {
          return 0
      }
  
      return _userId
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I can call the function but when I print my <code>weeklyEnd</code> I would get <code>http://anyapi/api/users/(Function)/quarterly/tasks</code> instead of <code>http://anyapi/api/users/3/quarterly/tasks</code></p>
  
  <pre><code>let user = Users()
  
  func getId() -&gt; String
  {
      let id = String(user.userId)
      return id
  }
  
  static let weeklyEndpoint: String = "http://anyapi/api/users/\(getId)/quarterly/tasks"
  </code></pre>
  
  <p><strong>UPDATE 2</strong></p>
  
  <pre><code>import Foundation
  
  class Data {
  
  static let sharedInstance = Data()
  
  let user = Users()
  let id:String?
  let weeklyEndpoint: String?
  
  // for prevent from creating this class object
  private init() {
      id   = String((user.userId))
      //Login.swift
      weeklyEndpoint = "http://anyapi/api/users/\(id)/quarterly/tasks"
  }
  
  }
  </code></pre>
  
  <p>I'm having trouble calling my <code>weeklyEndPoint</code> from outside the <code>Data</code> class. I've tried <code>Data.weeklyEndPoint</code> but it's not working</p>