everyone! I'm building an app for making documents(UIKit). And after user fill all the info, the app presents a filled document. I use UIDocumentInteractionController to present it on full screen and I would like to prevent making screenshooting of that screen. That's how I open a document
let docOpener = UIDocumentInteractionController.init(url: path)
docOpener.delegate = self
docOpener.presentPreview(animated: true)
extension PreviewVC: UIDocumentInteractionControllerDelegate {
func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
return self
}
func documentInteractionControllerViewForPreview(_ controller: UIDocumentInteractionController) -> UIView? {
return self.view
}
func documentInteractionControllerRectForPreview(_ controller: UIDocumentInteractionController) -> CGRect {
return self.view.frame
}
}
I've tried to use ScreenshotPreventing-iOS framework and also this extension
extension UIView {
func makeSecure() {
DispatchQueue.main.async {
let field = UITextField()
field.isSecureTextEntry = true
self.addSubview(field)
field.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
field.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
self.layer.superlayer?.addSublayer(field.layer)
field.layer.sublayers?.first?.addSublayer(self.layer)
}
}
That's works, but it hides only UIView from screenshots. As I understood the UIDocumentInteractionController has no view inside and don't allow to work somehow with its layer that shows opened document. So also i've tried to put a UIView under the UIDocumentInteractionController and hide it together but it doesn't work. Please help me to hide info somehow. Thanks