How to restrict certain characters in UITextField in Swift?
<p>I am creating a trivia application that asks for a username on start up. I'd like to make it impossible to use characters such as #$@!^&amp; etc (also including "space"). I took a look at this post <a href="https://stackoverflow.com/questions/14557925/how-to-restrict-special-characters-in-uitextfield-except-dot-and-underscores">here</a> but it is written entirely in Objective-C. Thanks in advance.</p>