I know how to execute a function after screenshot with:
func detectScreenShot(action: @escaping () -> ()) {
let mainQueue = OperationQueue.main
NotificationCenter.default.addObserver(forName: .UIApplicationUserDidTakeScreenshot, object: nil, queue: mainQueue) { notification in
// executes after screenshot
action()
}
}
But what I'm looking for is how to execute it before the screenshot is saved?
what I want is that when a user takes a screen shot of the app, the screenshot will be saved with the logo of the app in the corner.
so there is an image in the corner of my UIView. and for now it is Hidden.
the function that I want to execute is something like:
myImage.isHidden = false
is there a way to do this?