SwiftSnippets
// check the name is between 4 and 16 characters
if !(4...16 ~= name.characters.count) {
return false
}
// check that name doesn't contain whitespace or newline characters
let range = name.rangeOfCharacterFromSet(.whitespaceAndNewlineCharacterSet())
if let range = range where range.startIndex != range.endIndex {
return false
}