5 // Created by Pawel Dabrowski on 30/05/2018.
6 // Copyright © 2018 Fundacja Nowoczesna Polska. All rights reserved.
11 struct BookModel: Codable{
25 var simple_thumb: String!
29 var cover_color: String!
30 var full_sort_key: String!
32 var bgColor: UIColor {
33 return UIColor(hex: cover_color)
36 private enum CodingKeys: String, CodingKey {
58 func getCoverThumbUrl() -> URL?{
59 return simple_thumb.getPhotoUrl()
62 func getAttributedAuthorAndTitle(titleFont: UIFont, descFont: UIFont) -> NSAttributedString{
63 let titleAttributedText = NSMutableAttributedString(attributedString: NSAttributedString(string: author, font: titleFont))
64 titleAttributedText.append(NSAttributedString(string: "\n\n", font: UIFont.systemFont(ofSize: 2)))
66 titleAttributedText.append(NSAttributedString(string: title, font: descFont))
67 return titleAttributedText