Created
April 22, 2015 15:53
-
-
Save danielgomezrico/ae53fae471168dde6c21 to your computer and use it in GitHub Desktop.
"NSURL == String url" extension in swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSURL { | |
/** | |
Check if the url:String is equivalent to NSURL | |
:param: url to compare me | |
:returns: true if is the same false otherwise | |
*/ | |
func isEquivalent(url: String) -> Bool { | |
if let myUrl = absoluteString { | |
let urlComponents = url.componentsSeparatedByString("?") | |
let myUrlComponents = myUrl.componentsSeparatedByString("?") | |
return urlComponents.first == myUrlComponents.first | |
} | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment