Last active
September 26, 2020 23:54
-
-
Save jppsantos/2480fada8e9186be7c22464f1cecdda8 to your computer and use it in GitHub Desktop.
This file contains 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
enum PurchaseEndpoint: String { | |
private var baseURL: String { return "https://www.purchase.com" } | |
case product = "/product" | |
case user = "/user" | |
case store = "/store" | |
case payment = "/payment" | |
var url: URL { | |
guard let url = URL(string: baseURL) else { | |
preconditionFailure("The url used in \(PurchaseEndpoint.self) is not valid") | |
} | |
return url.appendingPathComponent(self.rawValue) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment