개발/swift

Swift validation

lemonade 2020. 10. 5. 22:31
반응형

Swift validation

 

Sometimes we want to validate forms with many fields, for example name, phone, email, and with different rules.

 

In swift, we can use predicate and extension.

 

Define your regular expression and predicate.

 

 

 

Next step, use predicate in extension.

 

 

Tada, you can call it everywhere.

반응형
그리드형

'개발 > swift' 카테고리의 다른 글

Alamofire 5 Network Interceptor  (0) 2020.10.12
Multiple link UILabel in swift  (0) 2020.10.11
Swift navigation controller freeze on swipe gesture  (0) 2020.10.07
Swift IBInspectable and IBDesignable  (0) 2020.10.06
Swift structure vs class  (0) 2020.10.01