Start a Project

Check the Valid String for UITextField (non Emoji) in Swift 4.2 .

Check the Valid String

In Most of App  we use the UITextfield  for getting the value from user like their name , email or other details , some time user will make the entry of emoji so it is not a valid & we have to face lot of issue to restrict this type of string .

In iOS what we can do , we can select the ASCII Keyboard type but it will work only for English  language input but it will not support for other language.

For This what we have to do.

Follow This Steps:

1: First we will take a UITextfield like Firstname

Create a Outlet of this :

@IBOutlet weak var firstNameTextField: UITextField!

2: Take a Submit Button where the user will click & get the Value of Textfield.

Here we will have to check weather the value are empty , valid .

for that write this code.

3: Now write the Extension.

 

Note:

1: In first step we are checking the space character .

2: but in second step we are checking weather the string contains emoji or not

 

 

 

4: Now write this Extension for checking the string contains emoji or not .

 

5: With the help of this Extension you can verified the string contains emoji or valid emoji or only emoji string .

 

 

 

 

 

 

 

 

 

 

 

 

 

Exit mobile version