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

Add custom unzip path setting to FolioReaderContainer#306

Merged
hebertialmeida merged 2 commits into
FolioReader:masterfrom
revolter:hotfix/config-unzip-path
Jan 22, 2018
Merged

Add custom unzip path setting to FolioReaderContainer#306
hebertialmeida merged 2 commits into
FolioReader:masterfrom
revolter:hotfix/config-unzip-path

Conversation

@revolter
Copy link
Copy Markdown
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
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

2 participants