Skip to content

Commit 590c29c

Browse files
committed
Format code
1 parent 4747967 commit 590c29c

File tree

10 files changed

+46
-46
lines changed

10 files changed

+46
-46
lines changed

DatWeatherDoe/API/Response/AirQuality.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// AirQualityIndex.swift
2+
// AirQuality.swift
33
// DatWeatherDoe
44
//
55
// Created by Inder Dhir on 7/1/24.
@@ -16,7 +16,7 @@ enum AirQualityIndex: Int, Decodable {
1616
case unhealthy = 4
1717
case veryUnhealthy = 5
1818
case hazardous = 6
19-
19+
2020
var description: String {
2121
switch self {
2222
case .good:

DatWeatherDoe/API/Response/WeatherAPIResponse.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,61 +18,61 @@ struct WeatherAPIResponse: Decodable {
1818
let uvIndex: Double
1919
let forecastDayData: ForecastDayData
2020
let airQualityIndex: AirQualityIndex
21-
21+
2222
private enum RootKeys: String, CodingKey {
2323
case location, current, forecast
2424
}
25-
25+
2626
private enum LocationKeys: String, CodingKey {
2727
case name
2828
}
29-
29+
3030
private enum CurrentKeys: String, CodingKey {
3131
case isDay = "is_day"
3232
case condition, humidity
3333
case airQuality = "air_quality"
3434
case uvIndex = "uv"
3535
}
36-
36+
3737
private enum WeatherConditionKeys: String, CodingKey {
3838
case code
3939
}
40-
40+
4141
private enum ForecastKeys: String, CodingKey {
4242
case forecastDay = "forecastday"
4343
}
44-
44+
4545
private enum ForecastDayKeys: String, CodingKey {
4646
case day, astro
4747
}
48-
48+
4949
private enum AirQualityKeys: String, CodingKey {
5050
case usEpaIndex = "us-epa-index"
5151
}
52-
52+
5353
init(from decoder: Decoder) throws {
5454
let container = try decoder.container(keyedBy: RootKeys.self)
55-
55+
5656
let locationContainer = try container.nestedContainer(keyedBy: LocationKeys.self, forKey: .location)
5757
locationName = try locationContainer.decode(String.self, forKey: .name)
5858
temperatureData = try container.decode(TemperatureData.self, forKey: .current)
59-
59+
6060
let currentContainer = try container.nestedContainer(keyedBy: CurrentKeys.self, forKey: .current)
6161
let isDayInt = try currentContainer.decode(Int.self, forKey: .isDay)
6262
isDay = isDayInt > 0
63-
63+
6464
let weatherConditionContainer = try currentContainer.nestedContainer(
6565
keyedBy: WeatherConditionKeys.self,
6666
forKey: .condition
6767
)
6868
weatherConditionCode = try weatherConditionContainer.decode(Int.self, forKey: .code)
69-
69+
7070
humidity = try currentContainer.decode(Int.self, forKey: .humidity)
7171

7272
windData = try container.decode(WindData.self, forKey: .current)
73-
73+
7474
uvIndex = try currentContainer.decode(Double.self, forKey: .uvIndex)
75-
75+
7676
let forecast = try container.decode(Forecast.self, forKey: .forecast)
7777
if let dayData = forecast.dayDataArr.first {
7878
forecastDayData = dayData
@@ -83,11 +83,11 @@ struct WeatherAPIResponse: Decodable {
8383
debugDescription: "Missing forecast day data"
8484
)
8585
}
86-
86+
8787
let airQualityContainer = try currentContainer.nestedContainer(keyedBy: AirQualityKeys.self, forKey: .airQuality)
8888
airQualityIndex = try airQualityContainer.decode(AirQualityIndex.self, forKey: .usEpaIndex)
8989
}
90-
90+
9191
init(
9292
locationName: String,
9393
temperatureData: TemperatureData,

DatWeatherDoe/Config/ConfigManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protocol ConfigManagerType: AnyObject {
2525

2626
func updateWeatherSource(_ source: WeatherSource, sourceText: String)
2727
func setConfigOptions(_ options: ConfigOptions)
28-
28+
2929
var parsedMeasurementUnit: MeasurementUnit { get }
3030
}
3131

@@ -80,7 +80,7 @@ final class ConfigManager: ConfigManagerType {
8080
valueSeparator = options.valueSeparator
8181
isWeatherConditionAsTextEnabled = options.isWeatherConditionAsTextEnabled
8282
}
83-
83+
8484
var parsedMeasurementUnit: MeasurementUnit {
8585
MeasurementUnit(rawValue: measurementUnit) ?? .imperial
8686
}

DatWeatherDoe/UI/Decorator/Condition/WeatherCondition.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ enum WeatherCondition {
2020
static func getFallback(isDay: Bool) -> WeatherCondition {
2121
isDay ? .sunny : .clearNight
2222
}
23-
23+
2424
var symbolName: String {
2525
switch self {
2626
case .cloudy:
@@ -45,7 +45,7 @@ enum WeatherCondition {
4545
"cloud.fog"
4646
}
4747
}
48-
48+
4949
var accessibilityLabel: String {
5050
switch self {
5151
case .cloudy:

DatWeatherDoe/UI/Menu Bar/DropdownIcon.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ enum DropdownIcon {
1313
case sun
1414
case wind
1515
case uvIndexAndAirQualityText
16-
16+
1717
var symbolName: String {
1818
switch self {
1919
case .location:
@@ -28,7 +28,7 @@ enum DropdownIcon {
2828
"sun.max.circle"
2929
}
3030
}
31-
31+
3232
var accessibilityLabel: String {
3333
switch self {
3434
case .location:

DatWeatherDoe/UI/Status Bar/StatusBarView.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import SwiftUI
1010

1111
struct StatusBarView: View {
1212
let weatherResult: Result<WeatherData, Error>?
13-
13+
1414
var body: some View {
1515
if let weatherResult {
1616
switch weatherResult {
@@ -33,22 +33,22 @@ struct StatusBarView: View {
3333
}
3434

3535
#if DEBUG
36-
#Preview {
37-
StatusBarView(
38-
weatherResult: .success(
39-
.init(
40-
showWeatherIcon: true,
41-
textualRepresentation: "88",
42-
weatherCondition: .cloudy,
43-
response: response
36+
#Preview {
37+
StatusBarView(
38+
weatherResult: .success(
39+
.init(
40+
showWeatherIcon: true,
41+
textualRepresentation: "88",
42+
weatherCondition: .cloudy,
43+
response: response
44+
)
4445
)
4546
)
46-
)
47-
.frame(width: 100, height: 50)
48-
}
49-
50-
#Preview {
51-
StatusBarView(weatherResult: .failure(WeatherError.latLongIncorrect))
5247
.frame(width: 100, height: 50)
53-
}
48+
}
49+
50+
#Preview {
51+
StatusBarView(weatherResult: .failure(WeatherError.latLongIncorrect))
52+
.frame(width: 100, height: 50)
53+
}
5454
#endif

DatWeatherDoe/ViewModel/Repository/WeatherURLBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class WeatherURLBuilder: WeatherURLBuilderType {
4141
}
4242
return finalUrl
4343
}
44-
44+
4545
private var parsedDateToday: String {
4646
let dateFormatter = DateFormatter()
4747
dateFormatter.dateFormat = "yyyy-MM-dd"

DatWeatherDoe/ViewModel/WeatherDataFormatter.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// WeatherDataParser.swift
2+
// WeatherDataFormatter.swift
33
// DatWeatherDoe
44
//
55
// Created by Inder Dhir on 6/24/24.
@@ -36,7 +36,7 @@ final class WeatherDataFormatter: WeatherDataFormatterType {
3636
temperatureData: data.response.temperatureData,
3737
forecastTemperatureData: data.response.forecastDayData.temp,
3838
options: .init(
39-
unit: configManager.parsedMeasurementUnit.temperatureUnit,
39+
unit: configManager.parsedMeasurementUnit.temperatureUnit,
4040
isRoundingOff: configManager.isRoundingOffData,
4141
isUnitLetterOff: configManager.isUnitLetterOff,
4242
isUnitSymbolOff: configManager.isUnitSymbolOff
@@ -66,7 +66,7 @@ final class WeatherDataFormatter: WeatherDataFormatterType {
6666
)
6767
}
6868
}
69-
69+
7070
func getUVIndexAndAirQuality(for data: WeatherData) -> String {
7171
let uvIndex = "UV Index: \(data.response.uvIndex)"
7272
let airQualityIndex = "AQI: \(data.response.airQualityIndex.description)"

DatWeatherDoe/ViewModel/WeatherViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class WeatherViewModel: WeatherViewModelType, ObservableObject {
4949
weatherTask?.cancel()
5050
}
5151
}
52-
52+
5353
func setup(with formatter: WeatherDataFormatter) {
5454
dataFormatter = formatter
5555
}

DatWeatherDoeTests/API/Repository/WeatherURLBuilderTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class WeatherURLBuilderTests: XCTestCase {
1616
"https://api.weatherapi.com/v1/forecast.json?key=123456&aqi=no&q=42.0,42.0&dt=\(parsedDateToday)"
1717
)
1818
}
19-
19+
2020
private var parsedDateToday: String {
2121
let dateFormatter = DateFormatter()
2222
dateFormatter.dateFormat = "yyyy-MM-dd"

0 commit comments

Comments
 (0)