Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In Swift 3 (and probably previous versions as well), `String.count` defaulted to the count of the Unicode scalar representation. In this version, iterating over a string would operate on each Unicode scalar, which often doesn't make sense due to the expected behaviour of extended grapheme clusters. So, this is my best guess why `String` in Swift 4 and later ended up with the current default behaviour.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: