Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to restrict user to take the screen shot , can i use this in my whole app , and can i implement this. Can you please help me in this. #16

Open
AjaychaudharyApplify opened this issue Nov 20, 2023 · 1 comment

Comments

@AjaychaudharyApplify
Copy link

No description provided.

@kushal211
Copy link

Try this - this will restrict the entire window.

func makeSecure(window: UIWindow) {
        let field = UITextField()

        let view = UIView(frame: CGRect(x: 0, y: 0, width: field.frame.self.width, height: field.frame.self.height))

        let image = UIImageView(image: UIImage(named: "whiteImage"))
        image.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)

        field.isSecureTextEntry = true

        window.addSubview(field)
        view.addSubview(image)

        window.layer.superlayer?.addSublayer(field.layer)
        field.layer.sublayers?.last!.addSublayer(window.layer)

        field.leftView = view
        field.leftViewMode = .always
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants