So I am stuck with only allowing .edu college emails on my app. I already have it set as accepting any email but I want to change it to only accept .edu emails. Anyone have a function/code that could show me on how to do this? I would really appreciate it. Thank you!
Asked
Active
Viewed 231 times
-1
-
You can validate the email in Swift using Regular Expressions. – Code Jun 22 '16 at 08:59
-
Can you give me an example? – Jesus Aaron Nieto Jun 22 '16 at 09:06
1 Answers
0
You can check if an email address ends in ".edu" like this:
let endsInEdu = email.hasSuffix(".edu")
Note that the email address may not be valid even if this returns true.

Code
- 6,041
- 4
- 35
- 75