Created
December 19, 2016 22:53
-
-
Save ptrkstr/634a90eae69f786b937d0d775541d3e1 to your computer and use it in GitHub Desktop.
URL Extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension URL { | |
/// Converts URL to a "https" scheme | |
func secure() -> URL? { | |
guard var comps = URLComponents(url: self, resolvingAgainstBaseURL: false) else { | |
return nil | |
} | |
comps.scheme = "https" | |
return comps.url | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment