Try the following:
contentString.enumerateSubstringsInRange(NSMakeRange(0, (contentString as NSString).length), options: NSStringEnumerationOptions.ByComposedCharacterSequences) { (substring, substringRange, enclosingRange, stop) -> () in
if((substring as NSString).length >= 2) {
NSLog("%@", substring)
}
}
Note , in order to access the length property String, you need to pass it in NSStringas shown above.
source
share