From e82372e05830668bf1b3e5807ce18566c41536d9 Mon Sep 17 00:00:00 2001 From: Pawel Milek Date: Wed, 1 May 2024 20:43:37 -0400 Subject: [PATCH] Clean up networking code --- .../Network/Service/WeatherEndpoint.swift | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/SwiftyForecast/Network/Service/WeatherEndpoint.swift b/SwiftyForecast/Network/Service/WeatherEndpoint.swift index 7860f56f..9f65a858 100644 --- a/SwiftyForecast/Network/Service/WeatherEndpoint.swift +++ b/SwiftyForecast/Network/Service/WeatherEndpoint.swift @@ -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.") + } } }