title: How can I create an array of classes in Swift
body: <p>I have created two classes, StepsCell and WeightCell</p>
  
  <pre><code>import UIKit
  
  class StepsCell {
      let name = "Steps"
      let count = 2000
  }
  
  
  import UIKit
  
  class WeightCell {
  
      let name = "Weight"
      let kiloWeight = 90
  }
  </code></pre>
  
  <p>In my VC I attempt to create an array, cellArray, to hold the objects.</p>
  
  <pre><code>import UIKit
  
  class TableViewController: UIViewController {
  
      var stepsCell = StepsCell()
      var weightCell = WeightCell()
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          var cellArray = [stepsCell, weightCell]
          println(StepsCell().name)
          println(stepsCell.name)
          println(cellArray[0].name)
  }
  </code></pre>
  
  <p>but when I index into the array :</p>
  
  <pre><code>println(cellArray[0].name)
  </code></pre>
  
  <p>I get nil.. Why?  How can I create an array that "holds" these classes and that I can index into to get the various variables (and functions to be added later).  I thought this would be a super simple thing but I can't find any answers for this.  Any ideas?</p>