title: Creating an alert or label text for no data on a Table View. Swift
body: <p>I have a table and what I want to do is display an alert when the table results are empty. So I have the alert displaying when it is empty however it also displays when it is full. What am I missing???
  In my ViewDidLoad:</p>
  
  <pre><code>    if appUsers.count &lt; 1 {
  
      // create the alert
      let alert = UIAlertController(title: "No Jammers found", message: "Sorry there are no Jammers matching your search preferences at this time. Try tweaking your search preferences or try this search later! Hope you find who you are looking for! Happy Jamming! ", preferredStyle: UIAlertControllerStyle.Alert)
  
      // add an action (button)
      alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
  
      // show the alert
      self.presentViewController(alert, animated: true, completion: nil)
  
  }
  </code></pre>
  
  <p><strong>Edit Code in number of rows</strong></p>
  
  <pre><code>  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
      if appUsers.count &lt; 1 {
  
          // create the alert
          let alert = UIAlertController(title: "No Jammers found", message: "Sorry there are no Jammers matching your search preferences at this time. Try tweaking your search preferences or try this search later! Hope you find who you are looking for! Happy Jamming! ", preferredStyle: UIAlertControllerStyle.Alert)
  
          // add an action (button)
          alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
  
          // show the alert
          self.presentViewController(alert, animated: true, completion: nil)
  
      }
  
      return appUsers.count
    } // no of rows
  </code></pre>