Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 1.78 KB

README.md

File metadata and controls

41 lines (29 loc) · 1.78 KB

BookKit

BookKit is a concise Swift package that offers a Book entity for out-of-the-box or DTO usage, and protocols for implementing services to import library data and retrieve book covers. Included are two service implementations for importing library data from Goodreads and requesting covers from the OpenLibrary API.

Usage

BookKit has two main protocols: BookImportService and CoverRequestService. Below are the two included service implementations with these protocols and how to use them in your app.

Importing Book Data

Using the BookImportManager along with a BookImportService implementation that integrates with Goodreads.

let importService = GoodreadsImportService()
let attributesToInclude = Book.allOptionalAttributes
let importManager = BookImportManager(service: importService, attributesToInclude: attributesToInclude)

let fileURL = Bundle.module.url(forResource: "GoodreadsLibraryExportFile", withExtension: "csv")!
let books = try? importManager.importBooks(fileURL: fileURL)

Requesting Book Covers

Using a CoverRequestService implementation that integrates with OpenLibrary.

let coverService = OpenLibraryCoverRequestService(imageSize: .small)
let coverURL = try coverService.getCoverURL(bookId: bookId)

License

BookKit is available under the MIT license. See LICENSE for more information.

Swift Package Index

Available through SPI: https://swiftpackageindex.com/viniciusbinder/BookKit.