Swift 3 conversion : value of type 'characterset' has no member 'characterIsMember'
In Swift 3, CharacterSet
is re-designed to work well with UnicodeScalar
rather than UTF-8 code point.
In this case, you can write something like this:
var containsAlphabets: Bool {
//Checks if any of the characters inside the string are alphabets
return self.unicodeScalars.contains {CharacterSet.letters.contains($0)}
}
Please try.
edit/update: Xcode 11.4 • Swift 5.1
extension StringProtocol {
var containsLetters: Bool { contains { $0.isLetter } }
}