Files
GitHawk/Classes/Systems/String+QueryItemValue.swift
Ryan Nystrom f98e60bffd web auth flow
2017-07-08 19:41:58 -04:00

24 lines
473 B
Swift

//
// String+QueryItemValue.swift
// Freetime
//
// Created by Ryan Nystrom on 7/8/17.
// Copyright © 2017 Ryan Nystrom. All rights reserved.
//
import Foundation
extension String {
func valueForQuery(key: String) -> String? {
guard let items = URLComponents(string: self)?.queryItems else { return nil }
for item in items {
if item.name == key {
return item.value
}
}
return nil
}
}