Re:Why Is Swift's String API So Hard?
by cballard on Friday November 06, 2015 @11:43AM
(#10520361)
That is not a Swift method, it's an Objective-C method on NSString, which Swift String can be silently converted to.
[ Parent
| on HN ]
Not anymore; those methods are implemented in an extension on `String` that don't always involve bridging back.
They're still only available if you import Foundation. They're just NSString methods with wrappers. The real problem is just that Swift itself doesn't have methods for locating a string in another string, or replacing strings in another string.
This is why I was careful to say that Swift's API is the best in terms of its fundamental design. It still has a lot of missing functionality compared to other languages right now.