Skip to content

Instantly share code, notes, and snippets.

@ratulSharker
Last active April 7, 2019 05:10
Show Gist options
  • Save ratulSharker/336ced848d93530fd997054ef49c60f6 to your computer and use it in GitHub Desktop.
Save ratulSharker/336ced848d93530fd997054ef49c60f6 to your computer and use it in GitHub Desktop.
Parsing the query string parameter from String.
import Foundation
extension String {
func getQueryValue(param: String) -> String? {
return URLComponents(string: self)?.queryItems?.filter({ (queryItem) -> Bool in
return queryItem.name == param
}).first?.value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment