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 { | |
private var baseURL: String { return "https://www.purchase.com" } | |
case product | |
case user | |
case shop | |
case payment | |
case productWith(UUID) | |
case userWith(UUID) | |
case shopWith(UUID) |
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" | |
private var fullPath: String { | |
return baseURL + self.rawValue |
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 { |
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
var baseURL = URL(string: "https://www.purchase.com") | |
baseURL?.appendPathComponent(PurchaseEndpoints.product.rawValue) | |
//output: = https://www.purchase.com/product |
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 { | |
case product = "/product" | |
case user = "/user" | |
case store = "/store" | |
case payment = "/payment" | |
} |