How to hide something in screenshots on iOS?

Şükrü Can Avcı
Asis Technologies
Published in
2 min readJan 21, 2024

As you may know, UITextField has a property called isSecureTextEntry. This property works through a special view object embedded within the text field. If we can access this view object, we can manipulate it and use it to hide anything we want. I will show you exactly how to do that.

First, we locate this special view object inside the text field. The name of this view may vary depending on the iOS version, but I have found it by its latest name in iOS 15, 16, and 17. At the end of this article, I will share a link to a sample project on GitHub, which you can download and test.

guard let containers = textfield.subviews.filter { subview in
type(of: subview).description() == "_UITextLayoutCanvasView"
}

guard let secureView = containers.first else { return }

We can add anything we want to hide from screenshots and screen recordings into this view object we have found.

Github: https://github.com/sukrucanavci/iOS-ScreenShot-Secure-View/tree/main

See you in another article…

--

--