-
-
Save raul782/29d947d344dfd2aa055650f85222569b to your computer and use it in GitHub Desktop.
Retrieve specific query string parameter from NSURL
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
func getQueryStringParameter(url: String, param: String) -> String? { | |
let url = NSURLComponents(string: url)! | |
return | |
(url.queryItems? as [NSURLQueryItem]) | |
.filter({ (item) in item.name == param }).first? | |
.value() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment