title: My Swift class variable is empty
body: <p><a href="https://i.stack.imgur.com/saHln.png" rel="nofollow noreferrer">It's empty</a></p>
  
  <p>How can I keep the name in class?
  I will assign a variable value to the function I want to use and then I will use that variable in the load screen, my code is below:</p>
  
  <pre><code> import UIKit
  
      class userInfo{
          var name : String
  
          init(name : String) {
              self.name = name
          }
  
      }
      class userLoginViewController: UIViewController {
  
          @IBOutlet weak var lblSurucuAdi: UILabel!
  
          var userInfoClass :userInfo?
  
          override func viewDidLoad() {
              super.viewDidLoad()
  
                 userGet() 
  
  
              print(userInfoClass?.name)  // But it is empty here
  
          func userGet()
          {
  
  
            self.userInfoClass = userInfo(name: "emrekacan") // I make the username "emrekacan"
          }
        }
  </code></pre>