[swift-users] Was the String contains(_:) method changed in Swift 4?

Jens Alfke jens at mooseyard.com
Wed Nov 8 09:54:11 CST 2017

> On Nov 8, 2017, at 2:24 AM, Geordie Jay via swift-users <swift-users at swift.org> wrote:
> Would you be able to clarify where the line is between “tricky” and “not tricky” and if possible the reasoning behind making this distinction? Because as an outsider this seems to me like an unfortunate remnant of ObjC rather than an obvious and forward-thinking API decision.

The “only available after importing Foundation” thing has been around since 1.0 — it’s an artifact of the bridging of String and NSString*. After importing Foundation, the methods of NSString are implicitly available as an extension of String. I would think that by now the Swift standard library would have added those methods, but I guess not all of them…


* And IIRC it also manifests with Array, Dictionary, and other bridged classes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20171108/602f4ab8/attachment.html>

More information about the swift-users mailing list