Created
October 18, 2023 06:51
-
-
Save choco0908/db0d10e06b5a4849f91be0e1b62681b8 to your computer and use it in GitHub Desktop.
Prevent iOS Screen Capture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@available(iOS 13.0, *) | |
func makeSecure(window: UIWindow) { | |
DispatchQueue.main.async { | |
print("make window secure") | |
let field = UITextField() | |
field.isSecureTextEntry = true | |
window.addSubview(field) | |
window.layer.superlayer?.addSublayer(field.layer) | |
field.layer.sublayers?.last?.addSublayer(window.layer) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment