Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Add custom unzip path setting to FolioReaderContainer #306

Merged
merged 2 commits into from
Jan 22, 2018

Conversation

revolter
Copy link
Member

This allows writing:

import FolioReaderKit

func open(sender: AnyObject) {
    let config = FolioReaderConfig()
    let bookPath = Bundle.main.path(forResource: "book", ofType: "epub")
    let folioReader = FolioReader()
    folioReader.presentReader(parentViewController: self, withEpubPath: bookPath!, unzipPath: FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent("books"), andConfig: config)
}

or

import FolioReaderKit

class StoryboardFolioReaderContrainer: FolioReaderContainer {
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        
        let config = FolioReaderConfig()
        config.scrollDirection = .horizontalWithVerticalContent
        
        guard let bookPath = Bundle.main.path(forResource: "The Silver Chair", ofType: "epub") else { return }
        setupConfig(config, epubPath: bookPath, unzipPath: FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent("books"))
    }
}

Copy link
Member

@hebertialmeida hebertialmeida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, it is nice to have this control.

@hebertialmeida hebertialmeida merged commit 444ea35 into FolioReader:master Jan 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants