- added edit btn to full name - Linked the add child to the userregisteration details - Added Hindi Lingual file to profile view - Made the custom alert for deactivate account - updated the username check logic - Added logout api and handled the user logout - Handled the logout when device change globally
91 lines
2.9 KiB
Swift
91 lines
2.9 KiB
Swift
//
|
|
// StringValidations.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 29/04/24.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
// MARK: - Validation for numbers , name , name & number
|
|
|
|
extension String{
|
|
|
|
func nameCharacterOnly()->Bool{
|
|
let allowedCharacters = CharacterSet(charactersIn:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ").inverted
|
|
let components = string.components(separatedBy: allowedCharacters)
|
|
let filtered = components.joined(separator: "")
|
|
if string != filtered {
|
|
return false
|
|
}else{
|
|
return true
|
|
}
|
|
}
|
|
|
|
func onlyNumber()->Bool{
|
|
let allowedNumber = CharacterSet(charactersIn:"0123456789").inverted
|
|
let components = string.components(separatedBy: allowedNumber)
|
|
let filtered = components.joined(separator: "")
|
|
if string != filtered {
|
|
return false
|
|
}else{
|
|
return true
|
|
}
|
|
}
|
|
|
|
func onlyPhoneNumber()->Bool{
|
|
let allowedNumber = CharacterSet(charactersIn:"+0123456789").inverted
|
|
let components = string.components(separatedBy: allowedNumber)
|
|
let filtered = components.joined(separator: "")
|
|
if string != filtered {
|
|
return false
|
|
}else{
|
|
return true
|
|
}
|
|
}
|
|
|
|
func onlyNumberAndDecimal()->Bool{
|
|
let allowedNumber = CharacterSet(charactersIn:"0123456789.").inverted
|
|
let components = string.components(separatedBy: allowedNumber)
|
|
let filtered = components.joined(separator: "")
|
|
if string != filtered {
|
|
return false
|
|
}else{
|
|
return true
|
|
}
|
|
}
|
|
|
|
func numberAndCharacter()->Bool{
|
|
let allowedCharacters = CharacterSet(charactersIn:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ").inverted
|
|
let components = string.components(separatedBy: allowedCharacters)
|
|
let filtered = components.joined(separator: "")
|
|
if string != filtered {
|
|
return false
|
|
}else{
|
|
return true
|
|
}
|
|
}
|
|
|
|
func numberAndCharacterAndSpecialChar()->Bool{
|
|
let allowedCharacters = CharacterSet(charactersIn:"!@#$%^&*()+=-[]{};:'\"|<>,.?/~`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ").inverted
|
|
let components = string.components(separatedBy: allowedCharacters)
|
|
let filtered = components.joined(separator: "")
|
|
if string != filtered {
|
|
return false
|
|
}else{
|
|
return true
|
|
}
|
|
}
|
|
|
|
func userName()->Bool{
|
|
let allowedCharacters = CharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyz0123456789-_").inverted
|
|
let components = string.components(separatedBy: allowedCharacters)
|
|
let filtered = components.joined(separator: "")
|
|
if string != filtered {
|
|
return false
|
|
}else{
|
|
return true
|
|
}
|
|
}
|
|
}
|