Skip to content

Commit

Permalink
Clean up networking code
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelmilek committed May 2, 2024
1 parent d7736ee commit e82372e
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions SwiftyForecast/Network/Service/WeatherEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,17 @@ enum WeatherEndpoint: Endpoint {
private func parameterList(latitude: Double, longitude: Double) -> Parameters {
let parameters = ["lat": "\(latitude)",
"lon": "\(longitude)",
"appid": Constant.apiKey,
"appid": apiKey,
"units": "standard"]
return parameters
}

private enum Constant {
static var apiKey: String = {
do {
let value = try ConfigurationSettingsAccessor.value(for: .apiKey)
return value
} catch {
fatalError("Weather service APIKey is unavailable. Please, check configuration settings file.")
}
}()
private var apiKey: String {
do {
let value = try ConfigurationSettingsAccessor.value(for: .apiKey)
return value
} catch {
fatalError("Weather service APIKey is unavailable. Please, check configuration settings file.")
}
}
}

0 comments on commit e82372e

Please sign in to comment.