How to detect screenshots on iOS 17 beta?

I am able to detect screenshot only after screenshot is taken. UIApplication.userDidTakeScreenshotNotification. But my requirement is to detect at the same time while user is taking screenshot, so that I can hide my confidential data.

Please comment out if there are any better solutions or any callback functions available.

There is no means by which an application can prevent a screenshot. Screenshots are a user function, intended to allow users to capture anything on screen, including confidential information.

Consider that the alternative would be that the user would get more inventive, such as by using a second device to take a picture of the screen, which would then put this information on 2 devices. Instead of preventing the information from being captured, it has now been replicated to multiple devices.

How to detect screenshots on iOS 17 beta?
 
 
Q