Skip to content

Instantly share code, notes, and snippets.

@stonezhl
Last active August 16, 2019 15:29
Show Gist options
  • Select an option

  • Save stonezhl/206c5e274e589d968d5caeacd8de4cdd to your computer and use it in GitHub Desktop.

Select an option

Save stonezhl/206c5e274e589d968d5caeacd8de4cdd to your computer and use it in GitHub Desktop.
EPUBBook Class - 1
import Foundation
class EPUBBook {
let container: ContainerDocument
init?(contentsOf baseURL: URL) {
// Find the location of container.xml
let containerURL = baseURL.appendingPathComponent("META-INF/container.xml")
// Parse the container file
guard let container = ContainerDocument(url: containerURL) else { return nil }
self.container = container
// Get the location of the OPF file
let opfURL = baseURL.appendingPathComponent(container.opfPath)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment