Skip to content

Instantly share code, notes, and snippets.

@ugommirikwe
Forked from gillesdemey/querystring.swift
Created February 27, 2019 08:34
Show Gist options
  • Save ugommirikwe/9314ea42ef6711c6d02357940ade7374 to your computer and use it in GitHub Desktop.
Save ugommirikwe/9314ea42ef6711c6d02357940ade7374 to your computer and use it in GitHub Desktop.
Retrieve specific query string parameter from NSURL
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