class URLBuilder {
fileprivate static let base = "https://theAPI.com/"
fileprivate static let objectsPath = kBase + "objects/"
static func informationOfObject(withID id: Int) {
return objectsPath + "\(id)/" + "information/"
}
// Many other functions like this
}
let baseURL = URL(string: "/api/subPath")!
let variableURL = baseURL.appendingPathComponent("variable")
let trailingURL = variableURL.appendingPathComponent("otherSubPath")
print(trailingURL.absoluteString)