title: Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
body: <p>I am trying to write a code for a search bar in Swift on (Xcode):</p>
  
  <pre><code>    @IBOutlet weak var searchPost: UISearchBar!
      @IBOutlet weak var tbvPost: UITableView!
  
      var posts = [Post]()
      var filteredPosts = [Post]()
  
  extension PostViewController: UITableViewDelegate, UITableViewDataSource {
  
      func numberOfSections(in tableView: UITableView) -&gt; Int {
          return 1
      }
  
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
          if searchPost.text != "" {
              return self.filteredPosts.count
          }
  
          return self.posts.count
      }
  
  
  if searchPost.text != "" {
  </code></pre>
  
  <p>and  i am getting this error for that line:</p>
  
  <pre><code>Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  </code></pre>
  
  <p>Any ideas?</p>