I am using phone number texfield, now i am using this format for texfield (#) ### ### ###, now issue is that i want first character 0 as compulsary, like this (0) 959 554 54
If you create Enum, you can choice your textField type and make the extension properties for this field
func textField(_ textField: UITextField,
shouldChangeCharactersIn range: NSRange,
replacementString string: String) -> Bool {
if cellType == .phone {
guard var sanitizedText = textField.text else { return true }
if !sanitizedText.isEmpty && !sanitizedText.hasPrefix("(0)") {
sanitizedText.text = "(0)" + sanitizedText
}
}
}