Created
December 12, 2021 13:31
-
-
Save michzio/305756d8cf1e9aa3340615e477a7d3e8 to your computer and use it in GitHub Desktop.
SwiftUI MVVM architecture - Router
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 WordsetRouter: Router { | |
case getWordsets | |
case getWordset(id: String) | |
static var baseURL: String = "https://mockapi.com" | |
var path: String { | |
switch self { | |
case .getWordsets: | |
return "/wordsets" | |
case let .getWordset(id): | |
return "/wordsets/\(id)" | |
} | |
} | |
var method: HTTPMethod { | |
switch self { | |
case .getWordsets, .getWordset: | |
return .get | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment