I was in objective-c before. and this code below in objective C is working fine:
in. h
@property (retain)UIDocumentInteractionController *docControll
Swift 3
var docController: UIDocumentInteractionController?
if let path = Bundle.main.path(forResource: "book", ofType: "pdf") {
let targetURL = NSURL.fileURL(withPath: path)
docController = UIDocumentInteractionController(url: targetURL)
let url = NSURL(string:"itms-books:")
if UIApplication.shared.canOpenURL(url! as URL) {
docController!.presentOpenInMenu(from: CGRect.zero, in: self.view, animated: true)
}
}