GitHub - jphong1111/Useful_Swift: List of useful iOS & Swift

GitHub - jphong1111/Useful_Swift: List of useful iOS & Swift stuff!!


EndPointType file
Don't forget to put your API key in it!
var baseURL: URL {
guard let url = URL(string: "https://api.openweathermap.org/data/2.5/") else {
fatalError("baseURL could not be configured.")
}
return url
}
then make a instance of router.swift file in your code
private let router = Router()
for
enum with cases about specific api URL
It will make your router more dynamic!
Don't forget extension to EndPointType!
enum YourAPI {
case first(country: String)
case second(time: Int)
case third(name: String)
}
extension YourAPI: EndPointType {
var path: String {
switch self {
case .first(let country):
return "\(country).json"
case .second(let time):

Related Keywords

, Network Layer , Useful Swift , Swiftlint Option , View Model , Human Interface Guidelines , வலைப்பின்னல் அடுக்கு , பார்வை மாதிரி , மனிதன் இடைமுகம் வழிகாட்டுதல்கள் ,

© 2025 Vimarsana