Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. import Foundation
  2.  
  3. extension URL {
  4. public mutating func deleteQuery() {
  5. self = self.deletingQuery()
  6. }
  7.  
  8. public func deletingQuery() -> URL {
  9. guard var components = URLComponents(url: self, resolvingAgainstBaseURL: false) else { return self }
  10. components.query = nil
  11. return components.url ?? self
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement