EbookReader is, guess what, an ebook reader for iOS made with SwiftUI.
A while ago, I had a need to read Epub files for a personal project and iOS didn't have a native way to do it. Dependencies like FolioReaderKit were already obsolete and came with a lot of extra functionality that wasn't necessary for me, so EbookReader was born, a simple epub reader!
- Supports reading ePub files
- Customizes the background color, text color, and text size
- Saves the offset where the reading stopped so that, when returned, the reading will begin from where it left off.
- Displays a progress indicator showing the currently read position with respect to the remaining portion of the chapter.
- iOS 14.0+
- SwiftUI
- Create an instance of EbookReaderViewwithin your app.
- Call the loadBookmethod fromEbookReaderManagersingleton using your chosen book.
- Voila! Your book is loaded and ready for reading.
import EbookReader
struct ExampleView: View {
    private let myBookURL = Bundle.main.url(forResource: "alice", withExtension: "epub")
    // ...
    var body: some View {
        VStack {
            // ...
            EbookReaderView()
        }
        .onAppear {
          	EbookReaderManager.shared.loadBook(from: myBookURL)
        }
    }
}To navigate programmatically after loading your book, you can perform the following actions:
EbookReaderManager.shared.goForward() // To navigate to the next page
EbookReaderManager.shared.goBack() // To return to the previous page
EbookReaderManager.shared.scrollUp() // To scroll up within the page
EbookReaderManager.shared.scrollDown() // To scroll down within the pageYou can check the Demo folder for a comprehensive example
Add the following dependency to your Package.swift file:
dependencies: [
    .package(url: "https://github.com/dancarvajc/EbookReader.git", from: "0.1.0")
]Then, add YourPackage to your target dependencies:
.target(
    name: "YourTarget",
    dependencies: [
        "EbookReader"
    ]),Thanks to @stonezhl for providing the Bookbinder package
