title: How to implement the search operation for json shown in table view
body: <p>I am new in swift .I want implement the search operation for json show in table view about description field .  </p>
  
  <pre><code> func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
          let cell = tableView.dequeueReusableCell(withIdentifier: "discoveryNewscell") as! DiscoveryNewsTableViewCell
  
  
         classObject.getDataForTableView(results: results, index: indexPath.row)
          //let image_url = filteredsneakernews[indexPath.row].image
         // cell.sneakerImageView.image=filteredsneakernews[indexPath.row].image
  
          cell.newsTitle.text = classObject.descriptionn
  
          let imageURLPathString = newsurl + classObject.image
  
          let url1 = URL(string: imageURLPathString)
          print("xyz", url1)
          let data = try? Data(contentsOf: url1!)
  
          if let imageData = data {
              let image = UIImage(data: imageData)
              cell.sneakerImageView.image = image
          }
  
          return cell
  
  
      }
  </code></pre>
  
  <p>here is the class that i have made for getting data from json </p>
  
  <pre><code>class getData: NSObject {
  
      var descriptionn : String = ""
      var image : String = ""
  
  //    static let shared = getData()
  
      func getDataForTableView(results: [[String:String]], index : Int){
  
          var productArray = [String:String]()
          productArray = results[index]
  
              descriptionn = productArray["description"]!
              image = productArray["images"]!
  
      }
  }
  </code></pre>
  
  <p>here is my search filter function about description field in table view</p>
  
  <pre><code>var filteredsneakernews = [String]()
      func updateSearchResults(for searchController: UISearchController) {
              // If we haven't typed anything into the search bar then do not filter the results
  
              if searchController.searchBar.text! == "" {
                  filteredsneakernews = [classObject.descriptionn]
              } else {
                  // Filter the results
                  filteredsneakernews = [classObject.descriptionn].filter { $0.description.lowercased().contains(searchController.searchBar.text!.lowercased()) }
              }
              self.DiscoveryNewsTableView.reloadData()
          }
  </code></pre>
  
  <p>how to implement the search operation for json description field in table view .You can download the project from this link .<a href="https://drive.google.com/file/d/1HGQVN3QWFSQf1BcV-3Iv-pXOoWozcP1G/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1HGQVN3QWFSQf1BcV-3Iv-pXOoWozcP1G/view?usp=sharing</a></p>