Search Bar with JSON Objects in TableView - Swift










0















class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,UISearchDisplayDelegate

@IBOutlet weak var recipeTable: UITableView!

@IBOutlet weak var searchbarValue: UISearchBar!

// search functionality

var filteredAnswers: [JSON]?


func searchBarSearchButtonClicked(_ searchBar: UISearchBar)

self.filteredAnswers?.removeAll()
if (searchBar.text?.isEmpty)!
self.filteredAnswers = self.recipes else
if self.recipes.count > 0
for i in 0...self.recipes.count - 1
let answer = self.recipes[i] as [Dictionary<String, AnyObject>]
if answer.title.range(of: searchBar.text!, options: .caseInsensitive) != nil
self.filteredAnswers.append(answer)




recipeTable.reloadData();
recipeTable.reloadInputViews();
searchBar.resignFirstResponder()






//end search parameters


// tableview functionionalitys
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

return recipes.count




// tableview functionalities
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! RecipeTableViewCell

cell.recipeLabel.text = recipes[indexPath.row].title
//cell.textLabel?.text = recipe.title
//cell.imageView?.image = recipe.imageUrl

return cell




// structs for json
struct Root : Decodable
let count : Int
let recipes : [Recipe]


struct Recipe : Decodable // It's highly recommended to declare Recipe in singular form
let recipeId : String
let imageUrl, sourceUrl, f2fUrl : URL
let title : String
let publisher : String
let socialRank : Double
let page : Int?
let ingredients : [String]?


//recipes is array of Recipes
var recipes = [Recipe]() // array of recipes

//unfiltered recipes to put into search
var filteredRecipes = [Recipe]()




fileprivate func getRecipes()

let jsonURL = "http://food2fork.com/api/search?key=264045e3ff7b84ee346eb20e1642d9d9"
//.data(using: .utf8)!

//let somedata = Data(jsonURL.utf8)

guard let url = URL(string: jsonURL) elsereturn

URLSession.shared.dataTask(with: url) (data, response , err) in
if let response = response as? HTTPURLResponse, response.statusCode != 200
print(response.statusCode)
return

DispatchQueue.main.async

if let err = err
print("failed to get data from URL",err)
return

guard let data = data elsereturn
//print(String(data: data, encoding: .utf8))
do
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
let result = try decoder.decode(Root.self, from: data)
self.recipes = result.recipes
//print(result.recipes)
self.recipeTable.reloadData()
catch let jsonERR
print("Failed to decode",jsonERR)



.resume()





override func viewDidLoad()

super.viewDidLoad()

//search functionalities

self.searchbarValue.delegate = self

//call json object
getRecipes()




I am trying to implement a search bar that takes ingredients from the JSON Object and shows the recipes that contain those ingredients in my table view. I am hoping for some best practices and help with this. I have tried a couple different strategies and none seem to be working.



This is the last one I have tried to implement, but I am getting errors in the search functionality.




self.recipes.count in searchBarSearchButtonClicked Cannot assign value
of type '[ViewController.Recipe]' to type '[JSON]?




But I'm also getting an assertion failure in -




[UISearchResultsTableView
_dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:]




I would like to get help but also improve and find the best way to do this. Thanks.










share|improve this question




























    0















    class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,UISearchDisplayDelegate

    @IBOutlet weak var recipeTable: UITableView!

    @IBOutlet weak var searchbarValue: UISearchBar!

    // search functionality

    var filteredAnswers: [JSON]?


    func searchBarSearchButtonClicked(_ searchBar: UISearchBar)

    self.filteredAnswers?.removeAll()
    if (searchBar.text?.isEmpty)!
    self.filteredAnswers = self.recipes else
    if self.recipes.count > 0
    for i in 0...self.recipes.count - 1
    let answer = self.recipes[i] as [Dictionary<String, AnyObject>]
    if answer.title.range(of: searchBar.text!, options: .caseInsensitive) != nil
    self.filteredAnswers.append(answer)




    recipeTable.reloadData();
    recipeTable.reloadInputViews();
    searchBar.resignFirstResponder()






    //end search parameters


    // tableview functionionalitys
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

    return recipes.count




    // tableview functionalities
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

    let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! RecipeTableViewCell

    cell.recipeLabel.text = recipes[indexPath.row].title
    //cell.textLabel?.text = recipe.title
    //cell.imageView?.image = recipe.imageUrl

    return cell




    // structs for json
    struct Root : Decodable
    let count : Int
    let recipes : [Recipe]


    struct Recipe : Decodable // It's highly recommended to declare Recipe in singular form
    let recipeId : String
    let imageUrl, sourceUrl, f2fUrl : URL
    let title : String
    let publisher : String
    let socialRank : Double
    let page : Int?
    let ingredients : [String]?


    //recipes is array of Recipes
    var recipes = [Recipe]() // array of recipes

    //unfiltered recipes to put into search
    var filteredRecipes = [Recipe]()




    fileprivate func getRecipes()

    let jsonURL = "http://food2fork.com/api/search?key=264045e3ff7b84ee346eb20e1642d9d9"
    //.data(using: .utf8)!

    //let somedata = Data(jsonURL.utf8)

    guard let url = URL(string: jsonURL) elsereturn

    URLSession.shared.dataTask(with: url) (data, response , err) in
    if let response = response as? HTTPURLResponse, response.statusCode != 200
    print(response.statusCode)
    return

    DispatchQueue.main.async

    if let err = err
    print("failed to get data from URL",err)
    return

    guard let data = data elsereturn
    //print(String(data: data, encoding: .utf8))
    do
    let decoder = JSONDecoder()
    decoder.keyDecodingStrategy = .convertFromSnakeCase
    let result = try decoder.decode(Root.self, from: data)
    self.recipes = result.recipes
    //print(result.recipes)
    self.recipeTable.reloadData()
    catch let jsonERR
    print("Failed to decode",jsonERR)



    .resume()





    override func viewDidLoad()

    super.viewDidLoad()

    //search functionalities

    self.searchbarValue.delegate = self

    //call json object
    getRecipes()




    I am trying to implement a search bar that takes ingredients from the JSON Object and shows the recipes that contain those ingredients in my table view. I am hoping for some best practices and help with this. I have tried a couple different strategies and none seem to be working.



    This is the last one I have tried to implement, but I am getting errors in the search functionality.




    self.recipes.count in searchBarSearchButtonClicked Cannot assign value
    of type '[ViewController.Recipe]' to type '[JSON]?




    But I'm also getting an assertion failure in -




    [UISearchResultsTableView
    _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:]




    I would like to get help but also improve and find the best way to do this. Thanks.










    share|improve this question


























      0












      0








      0








      class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,UISearchDisplayDelegate

      @IBOutlet weak var recipeTable: UITableView!

      @IBOutlet weak var searchbarValue: UISearchBar!

      // search functionality

      var filteredAnswers: [JSON]?


      func searchBarSearchButtonClicked(_ searchBar: UISearchBar)

      self.filteredAnswers?.removeAll()
      if (searchBar.text?.isEmpty)!
      self.filteredAnswers = self.recipes else
      if self.recipes.count > 0
      for i in 0...self.recipes.count - 1
      let answer = self.recipes[i] as [Dictionary<String, AnyObject>]
      if answer.title.range(of: searchBar.text!, options: .caseInsensitive) != nil
      self.filteredAnswers.append(answer)




      recipeTable.reloadData();
      recipeTable.reloadInputViews();
      searchBar.resignFirstResponder()






      //end search parameters


      // tableview functionionalitys
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

      return recipes.count




      // tableview functionalities
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

      let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! RecipeTableViewCell

      cell.recipeLabel.text = recipes[indexPath.row].title
      //cell.textLabel?.text = recipe.title
      //cell.imageView?.image = recipe.imageUrl

      return cell




      // structs for json
      struct Root : Decodable
      let count : Int
      let recipes : [Recipe]


      struct Recipe : Decodable // It's highly recommended to declare Recipe in singular form
      let recipeId : String
      let imageUrl, sourceUrl, f2fUrl : URL
      let title : String
      let publisher : String
      let socialRank : Double
      let page : Int?
      let ingredients : [String]?


      //recipes is array of Recipes
      var recipes = [Recipe]() // array of recipes

      //unfiltered recipes to put into search
      var filteredRecipes = [Recipe]()




      fileprivate func getRecipes()

      let jsonURL = "http://food2fork.com/api/search?key=264045e3ff7b84ee346eb20e1642d9d9"
      //.data(using: .utf8)!

      //let somedata = Data(jsonURL.utf8)

      guard let url = URL(string: jsonURL) elsereturn

      URLSession.shared.dataTask(with: url) (data, response , err) in
      if let response = response as? HTTPURLResponse, response.statusCode != 200
      print(response.statusCode)
      return

      DispatchQueue.main.async

      if let err = err
      print("failed to get data from URL",err)
      return

      guard let data = data elsereturn
      //print(String(data: data, encoding: .utf8))
      do
      let decoder = JSONDecoder()
      decoder.keyDecodingStrategy = .convertFromSnakeCase
      let result = try decoder.decode(Root.self, from: data)
      self.recipes = result.recipes
      //print(result.recipes)
      self.recipeTable.reloadData()
      catch let jsonERR
      print("Failed to decode",jsonERR)



      .resume()





      override func viewDidLoad()

      super.viewDidLoad()

      //search functionalities

      self.searchbarValue.delegate = self

      //call json object
      getRecipes()




      I am trying to implement a search bar that takes ingredients from the JSON Object and shows the recipes that contain those ingredients in my table view. I am hoping for some best practices and help with this. I have tried a couple different strategies and none seem to be working.



      This is the last one I have tried to implement, but I am getting errors in the search functionality.




      self.recipes.count in searchBarSearchButtonClicked Cannot assign value
      of type '[ViewController.Recipe]' to type '[JSON]?




      But I'm also getting an assertion failure in -




      [UISearchResultsTableView
      _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:]




      I would like to get help but also improve and find the best way to do this. Thanks.










      share|improve this question
















      class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,UISearchDisplayDelegate

      @IBOutlet weak var recipeTable: UITableView!

      @IBOutlet weak var searchbarValue: UISearchBar!

      // search functionality

      var filteredAnswers: [JSON]?


      func searchBarSearchButtonClicked(_ searchBar: UISearchBar)

      self.filteredAnswers?.removeAll()
      if (searchBar.text?.isEmpty)!
      self.filteredAnswers = self.recipes else
      if self.recipes.count > 0
      for i in 0...self.recipes.count - 1
      let answer = self.recipes[i] as [Dictionary<String, AnyObject>]
      if answer.title.range(of: searchBar.text!, options: .caseInsensitive) != nil
      self.filteredAnswers.append(answer)




      recipeTable.reloadData();
      recipeTable.reloadInputViews();
      searchBar.resignFirstResponder()






      //end search parameters


      // tableview functionionalitys
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

      return recipes.count




      // tableview functionalities
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

      let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! RecipeTableViewCell

      cell.recipeLabel.text = recipes[indexPath.row].title
      //cell.textLabel?.text = recipe.title
      //cell.imageView?.image = recipe.imageUrl

      return cell




      // structs for json
      struct Root : Decodable
      let count : Int
      let recipes : [Recipe]


      struct Recipe : Decodable // It's highly recommended to declare Recipe in singular form
      let recipeId : String
      let imageUrl, sourceUrl, f2fUrl : URL
      let title : String
      let publisher : String
      let socialRank : Double
      let page : Int?
      let ingredients : [String]?


      //recipes is array of Recipes
      var recipes = [Recipe]() // array of recipes

      //unfiltered recipes to put into search
      var filteredRecipes = [Recipe]()




      fileprivate func getRecipes()

      let jsonURL = "http://food2fork.com/api/search?key=264045e3ff7b84ee346eb20e1642d9d9"
      //.data(using: .utf8)!

      //let somedata = Data(jsonURL.utf8)

      guard let url = URL(string: jsonURL) elsereturn

      URLSession.shared.dataTask(with: url) (data, response , err) in
      if let response = response as? HTTPURLResponse, response.statusCode != 200
      print(response.statusCode)
      return

      DispatchQueue.main.async

      if let err = err
      print("failed to get data from URL",err)
      return

      guard let data = data elsereturn
      //print(String(data: data, encoding: .utf8))
      do
      let decoder = JSONDecoder()
      decoder.keyDecodingStrategy = .convertFromSnakeCase
      let result = try decoder.decode(Root.self, from: data)
      self.recipes = result.recipes
      //print(result.recipes)
      self.recipeTable.reloadData()
      catch let jsonERR
      print("Failed to decode",jsonERR)



      .resume()





      override func viewDidLoad()

      super.viewDidLoad()

      //search functionalities

      self.searchbarValue.delegate = self

      //call json object
      getRecipes()




      I am trying to implement a search bar that takes ingredients from the JSON Object and shows the recipes that contain those ingredients in my table view. I am hoping for some best practices and help with this. I have tried a couple different strategies and none seem to be working.



      This is the last one I have tried to implement, but I am getting errors in the search functionality.




      self.recipes.count in searchBarSearchButtonClicked Cannot assign value
      of type '[ViewController.Recipe]' to type '[JSON]?




      But I'm also getting an assertion failure in -




      [UISearchResultsTableView
      _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:]




      I would like to get help but also improve and find the best way to do this. Thanks.







      json swift






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 7:13









      Mr.Turtle

      1,00221025




      1,00221025










      asked Nov 14 '18 at 6:49









      zeekzeek

      73




      73






















          1 Answer
          1






          active

          oldest

          votes


















          0














          First of all your logic to filter the recipes cannot work and is very, very inefficient. It seems you copied and pasted the code from a completely unrelated source.



          Basically the type of the data source array and the type of the filtered array must be the same, so you have to use filteredRecipes rather than filteredAnswers.



          To filter the recipes with matching ingredients use filter and contains



          func searchBarSearchButtonClicked(_ searchBar: UISearchBar)

          filteredRecipes.removeAll()
          if let searchText = searchBar.text, !searchText.isEmpty
          self.filteredRecipes = self.recipes.filter recipe in
          guard let ingredients = recipe.ingredients else return false
          return ingredients.contains $0.range(of: searchText, options: .caseInsensitive) != nil

          else
          self.filteredRecipes = self.recipes


          recipeTable.reloadData();
          recipeTable.reloadInputViews();
          searchBar.resignFirstResponder()



          Actually this code is supposed to be executed in the delegate method



          func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String)


          rather than in searchBarSearchButtonClicked



          And – very important – you have to add a boolean property to indicate isSearching and in all related datasource and delegate methods you have to add a condition to show the data of filteredRecipes if isSearching is true.






          share|improve this answer

























          • i am still having some issues. When the search bar text is entered in the search bar, nothing happens. If i declare the searchBar.delegate = self in the viewdidload method it only allows me to type 1 character at a time and still nothing updates. I am using just the searchBar without Search Bar Display Controller if I change this, it will refresh the table but there will not be any results shown. @vadian

            – zeek
            Nov 14 '18 at 20:54











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294544%2fsearch-bar-with-json-objects-in-tableview-swift%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          First of all your logic to filter the recipes cannot work and is very, very inefficient. It seems you copied and pasted the code from a completely unrelated source.



          Basically the type of the data source array and the type of the filtered array must be the same, so you have to use filteredRecipes rather than filteredAnswers.



          To filter the recipes with matching ingredients use filter and contains



          func searchBarSearchButtonClicked(_ searchBar: UISearchBar)

          filteredRecipes.removeAll()
          if let searchText = searchBar.text, !searchText.isEmpty
          self.filteredRecipes = self.recipes.filter recipe in
          guard let ingredients = recipe.ingredients else return false
          return ingredients.contains $0.range(of: searchText, options: .caseInsensitive) != nil

          else
          self.filteredRecipes = self.recipes


          recipeTable.reloadData();
          recipeTable.reloadInputViews();
          searchBar.resignFirstResponder()



          Actually this code is supposed to be executed in the delegate method



          func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String)


          rather than in searchBarSearchButtonClicked



          And – very important – you have to add a boolean property to indicate isSearching and in all related datasource and delegate methods you have to add a condition to show the data of filteredRecipes if isSearching is true.






          share|improve this answer

























          • i am still having some issues. When the search bar text is entered in the search bar, nothing happens. If i declare the searchBar.delegate = self in the viewdidload method it only allows me to type 1 character at a time and still nothing updates. I am using just the searchBar without Search Bar Display Controller if I change this, it will refresh the table but there will not be any results shown. @vadian

            – zeek
            Nov 14 '18 at 20:54
















          0














          First of all your logic to filter the recipes cannot work and is very, very inefficient. It seems you copied and pasted the code from a completely unrelated source.



          Basically the type of the data source array and the type of the filtered array must be the same, so you have to use filteredRecipes rather than filteredAnswers.



          To filter the recipes with matching ingredients use filter and contains



          func searchBarSearchButtonClicked(_ searchBar: UISearchBar)

          filteredRecipes.removeAll()
          if let searchText = searchBar.text, !searchText.isEmpty
          self.filteredRecipes = self.recipes.filter recipe in
          guard let ingredients = recipe.ingredients else return false
          return ingredients.contains $0.range(of: searchText, options: .caseInsensitive) != nil

          else
          self.filteredRecipes = self.recipes


          recipeTable.reloadData();
          recipeTable.reloadInputViews();
          searchBar.resignFirstResponder()



          Actually this code is supposed to be executed in the delegate method



          func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String)


          rather than in searchBarSearchButtonClicked



          And – very important – you have to add a boolean property to indicate isSearching and in all related datasource and delegate methods you have to add a condition to show the data of filteredRecipes if isSearching is true.






          share|improve this answer

























          • i am still having some issues. When the search bar text is entered in the search bar, nothing happens. If i declare the searchBar.delegate = self in the viewdidload method it only allows me to type 1 character at a time and still nothing updates. I am using just the searchBar without Search Bar Display Controller if I change this, it will refresh the table but there will not be any results shown. @vadian

            – zeek
            Nov 14 '18 at 20:54














          0












          0








          0







          First of all your logic to filter the recipes cannot work and is very, very inefficient. It seems you copied and pasted the code from a completely unrelated source.



          Basically the type of the data source array and the type of the filtered array must be the same, so you have to use filteredRecipes rather than filteredAnswers.



          To filter the recipes with matching ingredients use filter and contains



          func searchBarSearchButtonClicked(_ searchBar: UISearchBar)

          filteredRecipes.removeAll()
          if let searchText = searchBar.text, !searchText.isEmpty
          self.filteredRecipes = self.recipes.filter recipe in
          guard let ingredients = recipe.ingredients else return false
          return ingredients.contains $0.range(of: searchText, options: .caseInsensitive) != nil

          else
          self.filteredRecipes = self.recipes


          recipeTable.reloadData();
          recipeTable.reloadInputViews();
          searchBar.resignFirstResponder()



          Actually this code is supposed to be executed in the delegate method



          func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String)


          rather than in searchBarSearchButtonClicked



          And – very important – you have to add a boolean property to indicate isSearching and in all related datasource and delegate methods you have to add a condition to show the data of filteredRecipes if isSearching is true.






          share|improve this answer















          First of all your logic to filter the recipes cannot work and is very, very inefficient. It seems you copied and pasted the code from a completely unrelated source.



          Basically the type of the data source array and the type of the filtered array must be the same, so you have to use filteredRecipes rather than filteredAnswers.



          To filter the recipes with matching ingredients use filter and contains



          func searchBarSearchButtonClicked(_ searchBar: UISearchBar)

          filteredRecipes.removeAll()
          if let searchText = searchBar.text, !searchText.isEmpty
          self.filteredRecipes = self.recipes.filter recipe in
          guard let ingredients = recipe.ingredients else return false
          return ingredients.contains $0.range(of: searchText, options: .caseInsensitive) != nil

          else
          self.filteredRecipes = self.recipes


          recipeTable.reloadData();
          recipeTable.reloadInputViews();
          searchBar.resignFirstResponder()



          Actually this code is supposed to be executed in the delegate method



          func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String)


          rather than in searchBarSearchButtonClicked



          And – very important – you have to add a boolean property to indicate isSearching and in all related datasource and delegate methods you have to add a condition to show the data of filteredRecipes if isSearching is true.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 14 '18 at 7:57

























          answered Nov 14 '18 at 7:43









          vadianvadian

          147k13158175




          147k13158175












          • i am still having some issues. When the search bar text is entered in the search bar, nothing happens. If i declare the searchBar.delegate = self in the viewdidload method it only allows me to type 1 character at a time and still nothing updates. I am using just the searchBar without Search Bar Display Controller if I change this, it will refresh the table but there will not be any results shown. @vadian

            – zeek
            Nov 14 '18 at 20:54


















          • i am still having some issues. When the search bar text is entered in the search bar, nothing happens. If i declare the searchBar.delegate = self in the viewdidload method it only allows me to type 1 character at a time and still nothing updates. I am using just the searchBar without Search Bar Display Controller if I change this, it will refresh the table but there will not be any results shown. @vadian

            – zeek
            Nov 14 '18 at 20:54

















          i am still having some issues. When the search bar text is entered in the search bar, nothing happens. If i declare the searchBar.delegate = self in the viewdidload method it only allows me to type 1 character at a time and still nothing updates. I am using just the searchBar without Search Bar Display Controller if I change this, it will refresh the table but there will not be any results shown. @vadian

          – zeek
          Nov 14 '18 at 20:54






          i am still having some issues. When the search bar text is entered in the search bar, nothing happens. If i declare the searchBar.delegate = self in the viewdidload method it only allows me to type 1 character at a time and still nothing updates. I am using just the searchBar without Search Bar Display Controller if I change this, it will refresh the table but there will not be any results shown. @vadian

          – zeek
          Nov 14 '18 at 20:54


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294544%2fsearch-bar-with-json-objects-in-tableview-swift%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          ReactJS Fetched API data displays live - need Data displayed static

          政党