2023-09-27

Prevent screenshot with 'isSecureTextEntry' is not working on iOS 17

I am using ‘isSecureTextEntry' on iOS 16 with this solution, https://stackoverflow.com/a/76390952/22598343

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)
        }
    }
}

It looks not working on iOS 17 now. Is there any other solutions?

I've tried the DRM way, but got really bad performance.



No comments:

Post a Comment