[swift-users] Why can't we get `URL` equal on the same path?

Keith Smiley k at keith.so
Sat Oct 15 00:17:50 CDT 2016


Just want to mention that there are some differences between `NSURL` and `URL`.
Here's an example from the repl:

```
  1> import Foundation
  2> NSURL(string: "")
$R0: NSURL? = "" {
  ObjectiveC.NSObject = {}
}
  3> URL(string: "")
$R1: URL? = nil
```

--
Keith Smiley

On 10/14, Jens Alfke via swift-users wrote:
>
> > On Oct 14, 2016, at 5:16 PM, zh ao via swift-users <swift-users at swift.org> wrote:
> >
> > In your opinion, `baseURL` is a factor more important than `path`. I can not unaccept your answer. But I want to know why? Is there a standard on URL equality?
>
> I think this is just a weirdness of NSURL (assuming you’re running this code on macOS or iOS.) I’ve always avoided the `relativeTo:` initializers of NSURL because the objects they produce behave (IMHO) unexpectedly.
>
> —Jens
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users


More information about the swift-users mailing list