My use case
1 – By default I have to prevent screen capture and recording of my app.
2 – But also We have option in setting menu to disable this prevention.
I have written the code to achieve my first use case and it’s working fine.
func disableScreenSharing(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
}
But I’m not sure how to achieve the second use case to remove prevention the screen capture and recording.
You answers is highly appreciable.
I have to enable and disable screen capture and screen recording from the setting menu.
how to achieve this in swift