Input Masking & Custom Masking
Blocking sensitive data on Zipy
Using ZipyBlock
import ZipyiOS
// Create a ZipyBlock on any UIView
let sensitiveView = UIView()
_ = ZipyBlock(on: sensitiveView)Last updated
Blocking sensitive data on Zipy
import ZipyiOS
// Create a ZipyBlock on any UIView
let sensitiveView = UIView()
_ = ZipyBlock(on: sensitiveView)Last updated
// Masking a button
private let maskedButton: UIButton = {
let button = UIButton(type: .system)
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("Masked Button", for: .normal)
_ = ZipyBlock(on: button) // This will mask the button in screenshots
return button
}()
// Masking a text field
private let sensitiveTextField: UITextField = {
let textField = UITextField()
textField.placeholder = "Sensitive Information"
textField.translatesAutoresizingMaskIntoConstraints = false
_ = ZipyBlock(on: textField) // This will mask the text field in screenshots
return textField
}()class CustomView: UIView {
@IBOutlet weak var sensitiveLabel: UILabel! {
didSet {
_ = ZipyBlock(on: sensitiveLabel)
}
}
}class PaymentViewController: UIViewController {
private let cardNumberField: UITextField = {
let field = UITextField()
field.placeholder = "Card Number"
return field
}()
private var maskBlock: ZipyBlock?
func toggleMasking(isEnabled: Bool) {
if isEnabled {
// Add masking
maskBlock = ZipyBlock(on: cardNumberField)
} else {
// Remove masking
maskBlock?.removeFromSuperview()
maskBlock = nil
}
}
}