Skip to content

drearycold/FolioReaderKit

ย 
ย 

Repository files navigation

FolioReader logo FolioReaderKit is an ePub reader and parser framework for iOS written in Swift.

Version License

Features

  • ePub 2 and ePub 3 support
  • Custom Fonts
  • Custom Text Size
  • Text Highlighting
  • List / Edit / Delete Highlights
  • Themes / Day mode / Night mode
  • Handle Internal and External Links
  • Portrait / Landscape
  • Reading Time Left / Pages left
  • In-App Dictionary
  • Media Overlays (Sync text rendering with audio playback)
  • TTS - Text to Speech Support
  • Parse epub cover image
  • RTL Support
  • Vertical or/and Horizontal scrolling
  • Share Custom Image Quotes NEW
  • Support multiple instances at same time, like parallel reading NEW
  • Book Search
  • Add Notes to a Highlight

Installation

FolioReaderKit is available through Swift Package Manager (SPM).

Swift Package Manager

In Xcode, go to File > Add Packages... and enter the repository URL:

https://github.com/drearycold/FolioReaderKit.git

Choose the dependency rule that suits your needs (e.g., Up to Next Major Version) and click Add Package.

Requirements

  • iOS 13.0+
  • macOS 11.0+ (Catalyst)
  • Xcode 12.0+

Basic Usage

To get started, this is a simple usage sample of using the integrated view controller. Note that you now need to provide a ReadiumGCDWebServer instance to serve the EPUB content locally.

import FolioReaderKit
import ReadiumGCDWebServer

let webServer = ReadiumGCDWebServer()

func open(sender: AnyObject) {
    let config = FolioReaderConfig()
    let bookPath = Bundle.main.path(forResource: "book", ofType: "epub")
    let folioReader = FolioReader()
    
    // Provide the webServer instance required for serving EPUB resources
    folioReader.presentReader(
        parentViewController: self, 
        withEpubPath: bookPath!, 
        andConfig: config,
        folioReaderCenterDelegate: nil,
        webServer: webServer
    )
}

For more usage examples check the Example folder.

Architecture & Migration

This fork features a modernized architecture:

  • SPM First: Migrated from CocoaPods/Carthage to Swift Package Manager.
  • Local WebServer: Uses GCDWebServer to serve EPUB assets via http://localhost, resolving file:// URL restrictions in modern WKWebView.
  • Concurrency: Adopts Swift async/await for EPUB parsing and extraction using ZIPFoundation.
  • Persistence: Removed the hard dependency on Realm. Integrators must now provide their own persistence via the FolioReaderPreferenceProvider, FolioReaderHighlightProvider, and FolioReaderBookmarkProvider protocols.

Author

Heberti Almeida

License

FolioReaderKit is available under the BSD license. See the LICENSE file.

About

๐Ÿ“š A Swift ePub reader and parser framework for iOS.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Swift 60.8%
  • JavaScript 38.3%
  • Other 0.9%