I call my screenshot protection function from an @IBInspectable and it worked for me to implement this change (attached before and after image) I added it to the view because if I added it to the window you will no longer be able to take a screenshot in nowhere in the app after the protection appears
before
after
Post
Replies
Boosts
Views
Activity
This order works for me, I have notifications extension