Having simple endpoint enum, like:
enum TraccarEndpoint: Endpoint {
case server
var baseURL: URL {
return URL(string: "http://demo.traccar.org/api")!
}
var path: String {
switch self {
case .server:
return "/server"
}
}
var url: URL {
let path = self.path
let baseURL = self.baseURL
let url = URL(string: path, relativeTo: baseURL)
return url!
}
}
expecting self.url = "http://demo.traccar.org/server", but self.url = "/server -- ttp://www.traccar.org/api". What is that?
var url: URL { return URL(string: path, relativeTo: baseURL)! }
Also no need to include slash in your server stringreturn "server"
– Pelagia