1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-11 23:39:14 +00:00

add thumbnails to the books example to make memory leaks easier to test

This commit is contained in:
Xiao Yu
2022-07-28 23:53:57 -07:00
parent fa72a85887
commit 8f4d9e9305
6 changed files with 118 additions and 26 deletions

View File

@@ -47,7 +47,10 @@ class ViewController: UITableViewController, BKHostBookApi {
let authors = (volumeInfo["authors"] as! [String]).joined(separator: " & ")
let pageCount = volumeInfo["pageCount"] as! Int32
let publishedDate = volumeInfo["publishedDate"] as! String
let summary = volumeInfo["description"] as! String
let summary = volumeInfo["description"] as! String?
let imageLinks = volumeInfo["imageLinks"] as! [String: Any]
let thumbnail: BKThumbnail = BKThumbnail.init()
thumbnail.url = imageLinks["thumbnail"] as! String?
let book: BKBook = BKBook.init()
book.author = authors
book.title = title
@@ -56,6 +59,7 @@ class ViewController: UITableViewController, BKHostBookApi {
book.pageCount = NSNumber.init(value: pageCount)
book.publishDate = publishedDate
book.summary = summary
book.thumbnail = thumbnail
newBooks.append(book)
}
DispatchQueue.main.async {