[swift-users] NSURLComponents - setting scheme bug?

Jens Alfke jens at mooseyard.com
Wed May 25 16:12:20 CDT 2016


> On May 25, 2016, at 1:56 PM, Michal Kalinowski via swift-users <swift-users at swift.org> wrote:
> 
> I have just discovered following behaviour of NSURLComponents and I'm looking for confirmation if it is in fact a bug.

Unless you’re using Swift on Linux plus the in-development Foundation framework, NSURLComponents is part of a system framework, not part of Swift.

> var components = NSURLComponents(string: "apple.com")!

That’s incorrect, and I’m surprised the method didn’t fail, since “apple.com” is not a valid URL. Try initializing an empty object and then setting its host to “apple.com”.

—Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160525/e7e0bb2e/attachment.html>


More information about the swift-users mailing list