I'm using Swift5's UserDefaults to store text key pair preferences. What some users of my app have been doing is accidentally adding a space before or after the string which is then causing problems.
Please can someone advise me on how I can intercept the submitted text string entered in settings and remove whitespaces before it is saved?