If you're using NSURLComponents the following concise extension will also do the trick:
extension NSURLComponents {
func getQueryStringParameter(name: String) -> String? {
return (self.queryItems? as [NSURLQueryItem])
.filter({ (item) in item.name == name }).first?
.value()
}
}