Skip to content

Instantly share code, notes, and snippets.

@raul782
Forked from gillesdemey/querystring.swift
Created October 12, 2018 21:56
Show Gist options
  • Save raul782/29d947d344dfd2aa055650f85222569b to your computer and use it in GitHub Desktop.
Save raul782/29d947d344dfd2aa055650f85222569b 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