title: Capturing data from Alamofire
body: <p>I'm having trouble retrieving data from my Alamofire request asynchronously.</p>
  
  <pre><code>class BookGetter {
  
      static let instance = BookGetter()
  
      func getBook(bookId: String) -&gt; Book {
  
          let rootUrl = "https://www.someusefulbookapi.com/bookid=?"
          let url = rootUrl + bookId
          var title = ""
  
          Alamofire.request(.GET, url).response { response in
  
              let jsonDict = JSON(data: response.2!)
  
              title = String(jsonDict["items"][0]["volumeInfo"]["title"])
          }
          let book = Book(title: title)
          print(book.title)
          return book
      }
  }
  </code></pre>
  
  <p>The output of <code>print(book.title)</code> is <code>""</code>, and I understand this is because the print statement is running before the request returns.</p>
  
  <p>How do I get the <code>book</code> instance to be returned only when it is instantiated with the data from the request?</p>