Secure View
Some apps display sensitive information — activation codes, QR codes, card numbers, PINs — that must not be captured in screenshots or screen recordings. The makeSecure() API marks specific views as protected, so that iOS excludes them from screenshots (Power + Volume) and screen recordings at the compositor level — they render as a black area in captured media.
To block screenshots across the entire application instead, see Screen Capture Blocking.
Usage
UIKit
Apply makeSecure() to any UIView, UIViewController, or UIWindowScene:
// Protect a specific view
sensitiveView.makeSecure()
// Protect a view controller's entire view
viewController.makeSecure()
// Protect all windows in a scene
scene.makeSecure()
// Protect an entire window
window.makeSecure()
makeSecure() returns a Bool indicating whether the protection was applied successfully. The call is idempotent — calling it multiple times is safe.
SwiftUI
Apply .makeSecure() to any SwiftUI view:
Text("Card: **** **** **** 1234")
.makeSecure()
// Or wrap a more complex view
VStack {
Image(qrCodeImage)
Text(activationCode)
}
.makeSecure()
Note:
.makeSecure()on SwiftUI views is designed exclusively for static, read-only display content (QR codes, activation codes, card numbers). Interactive content is not supported — user interactions (taps, gestures) are not forwarded into the protected view, lifecycle modifiers (.onAppear,.task) fire twice, and local@Stateis independent in each copy. For views with state or interaction, use.makeWindowSecure()instead:someView.makeWindowSecure()
Limitations
Simulator
The iOS Simulator does not implement the secure IOSurface mechanism. Screenshots taken with xcrun simctl io booted screenshot always show protected content. Test on a real physical device using a Power + Volume screenshot.
CarPlay and External Display
makeSecure() on a UIWindowScene skips non-application-role scenes (CarPlay, external display).
WebKit and Metal
WKWebView, AVPlayerLayer, and CAMetalLayer render into their own IOSurfaces. Marking a parent view as secure does not protect content rendered by these layers. They require their own protection mechanisms.
Implementation Note
Secure View uses an undocumented UIKit behavior verified to work on iOS 13–18 and iOS 26. It may stop working on future iOS versions if Apple changes relevant UIKit internals — in that case makeSecure() returns false and SwiftUI views display a fallback placeholder instead of hiding content silently.