/iOS-Document-Iteraction

iOS: How to copy epub files from your app to iBooks app

Primary LanguageSwiftMIT LicenseMIT

iOS: How to copy epub files from your app to iBooks app

alt tag

Apple provides this possibility via class UIDocumentInteractionController. It’s really simple to do. I’ll just keep here.

Example:

var controller = UIDocumentInteractionController()

let epubURL = NSBundle.mainBundle().URLForResource("test", withExtension: "epub")
controller.URL = epubURL
if !controller.presentOpenInMenuFromRect(button.bounds, inView: view, animated: true) {
  print("You don't have an app installed that can handle ePub files.")
}

alt tag

A class UIDocumentInteractionController has other features, you can read more details in Apple documentation.