I was normally using this code in a Swift 2.0 project, then I decided to update the project to version 3.0 and adapt some functions that have changed ... Only the last "range" argument I can not adapt.
Swift 2.0 code:
if let range = string.rangeOfCharacterFromSet(invalidCharacters, options: nil, range:Range<String.Index>(start: string.startIndex, end: string.endIndex)) {
return false
}
Code in Swift 3.0:
if let range = string.rangeOfCharacter(from: invalidCharacters, options: [], range: ){
return false
}