title: Swift 3: index out of range error
body: <p>I'm new to iOS. Doing project by watching tutorial which is written using Swift 2.<br> It works when author runs app but not in my case.</p>
  
  <p>ViewController:</p>
  
  <pre><code>var books = [[String: AnyObject]]()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      tableView.dataSource = self
      searchBar.delegate = self
  }
  </code></pre>
  
  <p>And the extension</p>
  
  <pre><code>extension ViewController: UITableViewDataSource {
  
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return 1
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "BookCell", for: indexPath)
  
          // error on this line
          if let volumeInfo = self.books[indexPath.row]["volumeInfo"] as? [String: AnyObject] {
              cell.textLabel?.text = volumeInfo["title"] as? String
              cell.detailTextLabel?.text = volumeInfo["subtitle"] as? String
          }
  
          return cell
      }
  }
  </code></pre>
  
  <p>The console output:</p>
  
  <p><a href="https://i.stack.imgur.com/qiOhA.png" rel="nofollow"><img src="https://i.stack.imgur.com/qiOhA.png" alt="enter image description here"></a></p>
  
  <p>Please, help me to identify what is the cause.</p>