First up, I moved your question to Core OS > Networking because it seems more about networking than about Swift.Second, I'm having a hard time understanding your actual question. At first blush it seems like you're simply trying to test URLs for equality, that is, you're trying to see if request.URL matches some fixed URL. Is that right? If so, == should work. Swift translates it to -[NSURL isEqual:]. For example: import Foundation let u1 = NSURL(string: http://foo.example.com)! let u2 = NSURL(string: http://bar.example.com)! let u3 = NSURL(string: http://foo.example.com)! println(u1 == u2) // prints false println(u1 == u3) // prints true println(u1 === u3) // prints falseNote that u1 and u3 are not the same object, so === returns false: [I tested this with Xcode 6.4 on OS X 10.10.4, although I expect it'd be the same for Swift 2.]println(u1 === u3) // prints falseIMPORTANT URL equality is more complex than you might think. Consider the following:let uR = NSURL(string: http://example.com) let uR1
Topic:
App & System Services
SubTopic:
Networking
Tags: