title: How to filter array model data based on user input in text field
body: <p>I having the <code>array</code> model data I load that data into <code>tableview</code>.</p>
  
  <p>I want to make the search functionality for that <code>tableview</code>. I take the text field and based on user input I filter that <code>array</code> and <code>reload</code> the <code>tableview</code>.</p>
  
  <p>please find my code bellow.</p>
  
  <p>in <code>tableview</code></p>
  
  <pre><code>    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell{
  
             let model = array[indexPath.row]
  
              if let rate = model.price
              {
                  cell.pricelbl.text = "$" + rate
              }
              cell.namelbl.text = model.prodName ?? ""
  
              if (indexPath.row % 2 == 0){
                  cell.uiview.backgroundColor = UIColor.white
  
              } else {
                  cell.uiview.backgroundColor = UIColor.lightBaground
                  cell.uiview.layer.cornerRadius = 15
              }
    }
  
  //Textfield delegate methods.
  
      func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -&gt; Bool {
          if textField == searchtextfield
          {
              var foundItems = [BaseApparel]()
              foundItems = self.array.filter { $0.prodName == searchtextfield.text! }
              self.array = foundItems
  
              self.searchtableview.reloadData()
          }
           return true
      }
  </code></pre>