title: Removing object from array in Swift 3
body: <p>In my application I added one object in array when select cell and unselect and remove object when re-select cell. I used that code but give me error.</p>
  
  <pre><code>extension Array {
      func indexOfObject(object : AnyObject) -&gt; NSInteger {
          return (self as NSArray).indexOfObject(object)
      }
  
      mutating func removeObject(object : AnyObject) {
          for var index = self.indexOfObject(object); index != NSNotFound; index = self.indexOfObject(object) {
              self.removeAtIndex(index)
          }
      }
  }
  
  class MyViewController: UITableViewController {
      var arrContacts: [Any] = []
      var contacts: [Any] = []
  
      func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
          arrContacts.removeObject(contacts[indexPath.row])
      }
  }
  </code></pre>
  
  <p>It gives me 2 error like that:</p>
  
  <pre><code>C-style for statement has been removed in Swift 3
  Value of type '[Any]' has no member 'removeObject'
  </code></pre>