Given the supplied String , how can I verify that String is a valid UUID in Swift?
String
A valid UUID (to my knowledge) may be:
33041937-05b2-464a-98ad-3910cbe0d09e 3304193705b2464a98ad3910cbe0d09e
You can use NSUUID
NSUUID
var uuid = NSUUID(uuidString: yourString)
This will return nil if yourString not a valid UUID
yourString
Note: this confirms only the first case that you presented, and not the second, but adding a hyphen is trivial.
Source: https://habr.com/ru/post/1213185/More articles:Subclass PFUser in fast - propertiesKotlin in different increments - javaQt signal slots, casting type in the new notation - c ++Adding an application to a hosted Django project - pythonLinux Linux Open Terminal Team - linuxHow can I make the reverse side of zip / mesh from List :: MoreUtils? - perlScript package to delete the old folder in this folder - cmdHow to install pub (using command line) for Dart on Ubuntu web server - command-lineSave secondary threads during debugging with Visual Studio - multithreadingIPhone / iOS Statistical Confidence - iosAll Articles