diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index ef58cdc31..4e9a31728 100755 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -75,9 +75,9 @@ class ViewController: UIViewController { } do { - if let image = try FolioReader.getCoverImage(bookPath) { - button?.setBackgroundImage(image, for: .normal) - } + let image = try FolioReader.getCoverImage(bookPath) + + button?.setBackgroundImage(image, for: .normal) } catch { print(error.localizedDescription) } diff --git a/Source/FolioReaderKit.swift b/Source/FolioReaderKit.swift index bab91a51d..a4af615d0 100755 --- a/Source/FolioReaderKit.swift +++ b/Source/FolioReaderKit.swift @@ -318,15 +318,15 @@ extension FolioReader { /** Read Cover Image and Return an `UIImage` */ - open class func getCoverImage(_ epubPath: String, unzipPath: String? = nil) throws -> UIImage? { + open class func getCoverImage(_ epubPath: String, unzipPath: String? = nil) throws -> UIImage { return try FREpubParser().parseCoverImage(epubPath, unzipPath: unzipPath) } - open class func getTitle(_ epubPath: String) throws -> String? { + open class func getTitle(_ epubPath: String) throws -> String { return try FREpubParser().parseTitle(epubPath) } - open class func getAuthorName(_ epubPath: String) throws-> String? { + open class func getAuthorName(_ epubPath: String) throws-> String { return try FREpubParser().parseAuthorName(epubPath) } }