title: get the array index in swift
body: <p>Here is my code in Swift for an iOS app.</p>
  
  <pre><code>class Test {
      var name: String
      var sname: String
  
      init(name: String, sname: String) {
          self.name = name
          self.sname = sname
      }
  }
  
  class ArrTest {
      var arr = [Test]()
      init() {
          arr.append(Test(name: "test1", sname: "surname1"))
          arr.append(Test(name: "test2", sname: "surname2"))
          arr.append(Test(name: "test3", sname: "surname3"))
          arr.append(Test(name: "test4", sname: "surname4"))
      }
  
  }
  
  var x = ArrTest()
  let obj = x.arr.filter { $0.name == "test1" }.first
  println(obj?.sname)
  </code></pre>
  
  <p>I want to get the index and not the object of the first array object (in the array var). The "obj" x.arr.filter... returns the first object. I need the index of the correct object.</p>