Created
September 3, 2015 12:18
-
-
Save nazywamsiepawel/331d29827c3a904d04de to your computer and use it in GitHub Desktop.
Extract query parameters 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
extension NSURL { | |
func queryParams() -> Dictionary<String, String> { | |
var params = Dictionary<String, String>() | |
if let queryParams = self.query?.componentsSeparatedByString("&") { | |
for param in queryParams { | |
var parts = param.componentsSeparatedByString("=") | |
params[parts[0]] = parts[1] | |
} | |
} | |
return params | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment