<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 14, 2016, at 7:33 AM, Zhao Xin via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif">As you can see, `URL` is not equal but the `path` is. I wonder why urls do not equal here?</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">let</span><span style="font-variant-ligatures:no-common-ligatures" class=""> url = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">URL</span><span style="font-variant-ligatures:no-common-ligatures" class="">(fileURLWithPath: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(209,47,27)" class="">"foo/bar"</span><span style="font-variant-ligatures:no-common-ligatures" class="">, isDirectory: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">false</span><span style="font-variant-ligatures:no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(62, 30, 129);" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> baseURL = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">url</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures:no-common-ligatures" class="">deletingLastPathComponent</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">let</span><span style="font-variant-ligatures:no-common-ligatures" class=""> newURL = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">URL</span><span style="font-variant-ligatures:no-common-ligatures" class="">(fileURLWithPath: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(209,47,27)" class="">"bar"</span><span style="font-variant-ligatures:no-common-ligatures" class="">, isDirectory: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">false</span><span style="font-variant-ligatures:no-common-ligatures" class="">, relativeTo: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">baseURL</span><span style="font-variant-ligatures:no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(62,30,129)" class="">print</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">url</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(62,30,129)" class="">==</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">newURL</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) </span><span style="font-variant-ligatures:no-common-ligatures" class="">// prints false</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(62,30,129)" class="">print</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">url</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">path</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(62,30,129)" class="">==</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">newURL</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">path</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) </span><span style="font-variant-ligatures:no-common-ligatures" class="">// prints true</span></div></div></div></div></blockquote><br class=""></div><div>Here's one reason:</div><div> print(url.baseURL == newURL.baseURL) // prints false</div><br class=""><div class=""><br class=""></div><div class="">-- </div><div class="">Greg Parker <a href="mailto:gparker@apple.com" class="">gparker@apple.com</a> Runtime Wrangler</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>