[swift-corelibs-dev] Bring NSString functions to String

Brent Royal-Gordon brent at architechies.com
Wed May 10 03:52:55 CDT 2017

> On May 8, 2017, at 9:39 AM, Eric Blachère via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> I was just wondering if there are plans to bring NSString functions manipulating paths into the native String class. (such as lastPathComponent, pathComponents etc...)
> Because even if we can always make an extension of String to easily cast it into NSString, it's still a bit of a shame to have to do it ;) 

Unfortunately, it seems like the decision not to include these methods on String was quite deliberate.

Here's the revision where that happened: <https://github.com/apple/swift/commit/1f2390f1c75be65f57f189247bfe4f9b2fc11e3b#diff-d38f60064c3752f096c043e756d8f201R925> As you can see, they had that working and chose to disable it, presumably because they want you to manipulate paths through `URL`. (I wish the radar referenced in the commit message were public, but alas, it's not.)

Brent Royal-Gordon

More information about the swift-corelibs-dev mailing list