FolioReaderKit is an ePub reader and parser framework for iOS written in Swift.
- 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
FolioReaderKit is available through Swift Package Manager (SPM).
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.
- iOS 13.0+
- macOS 11.0+ (Catalyst)
- Xcode 12.0+
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.
This fork features a modernized architecture:
- SPM First: Migrated from CocoaPods/Carthage to Swift Package Manager.
- Local WebServer: Uses
GCDWebServerto serve EPUB assets viahttp://localhost, resolvingfile://URL restrictions in modernWKWebView. - Concurrency: Adopts Swift
async/awaitfor EPUB parsing and extraction usingZIPFoundation. - Persistence: Removed the hard dependency on
Realm. Integrators must now provide their own persistence via theFolioReaderPreferenceProvider,FolioReaderHighlightProvider, andFolioReaderBookmarkProviderprotocols.
- Follow me on Twitter: @hebertialmeida
- Contact me on LinkedIn: hebertialmeida
FolioReaderKit is available under the BSD license. See the LICENSE file.