title: Pass data to variable in swift
body: <p>I want to assign button tag to variable. Then I trying send this data to SecondViewController and assign it to var.</p>
  <pre><code>@IBAction func goToProducts(_ sender: UIButton) {
      
      performSegue(withIdentifier: TextStrings.ProfileAluVC.goToProducts, sender: self)
      categoryNumber = sender.tag }
  </code></pre>
  <p>Pass data to ProductsViewController</p>
  <pre><code>override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
      if segue.identifier == &quot;goToProducts&quot; {
          let destinationController = segue.destination as! ProductsViewController
          destinationController.categoryNumb = categoryNumber
      }
  }
  </code></pre>
  <p>At ProductsViewController I create var but there isn't this data. I print this variable and I get this:</p>
  <blockquote>
  <p>categoryNumber: 373</p>
  <p>categoryNumb: Optional(24)</p>
  </blockquote>
  <p>Can you tell me haw can I do this?</p>