2 // URL+OAuthSwift.swift
5 // Created by Dongri Jin on 6/21/14.
6 // Copyright (c) 2014 Dongri Jin. All rights reserved.
13 func urlByAppending(queryString: String) -> URL {
14 if queryString.utf16.isEmpty {
18 var absoluteURLString = absoluteString
20 if absoluteURLString.hasSuffix("?") {
21 absoluteURLString.dropLast()
24 let string = absoluteURLString + (absoluteURLString.range(of: "?") != nil ? "&" : "?") + queryString
26 return URL(string: string)!