Skip to content

Commit 2c7a1ee

Browse files
committed
public weather service methods
1 parent c6dc88c commit 2c7a1ee

7 files changed

Lines changed: 1320 additions & 402 deletions

File tree

Sources/OpenWeatherKit/Public/Protocols/LocationProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99
#if canImport(CoreLocation)
1010
import CoreLocation
1111

12-
extension CLLocation: LocationProtocol, @unchecked Sendable {
12+
extension CLLocation: LocationProtocol {
1313
public var latitude: Double { coordinate.latitude }
1414
public var longitude: Double { coordinate.longitude }
1515
}

Sources/OpenWeatherKit/Public/WeatherError.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public enum WeatherError : LocalizedError, Equatable, Hashable {
2424

2525
case missingData(_ attributeName: String)
2626

27+
/// An invalid request parameter.
28+
case invalidRequest(_ message: String)
29+
2730
/// A localized message describing what error occurred.
2831
public var errorDescription: String? {
2932
switch self {
@@ -36,6 +39,8 @@ public enum WeatherError : LocalizedError, Equatable, Hashable {
3639
return NSLocalizedString("Error.timezone", bundle: Bundle.module, comment: "Could not determine timezone")
3740
case let .missingData(name):
3841
return String(format: NSLocalizedString("Error.missingData", bundle: Bundle.module, comment: "The data \(name) is missing from the response"), name)
42+
case let .invalidRequest(message):
43+
return message
3944
}
4045
}
4146

@@ -51,6 +56,8 @@ public enum WeatherError : LocalizedError, Equatable, Hashable {
5156
return NSLocalizedString("Error.timezone", bundle: Bundle.module, comment: "Could not determine timezone")
5257
case let .missingData(name):
5358
return String(format: NSLocalizedString("Error.missingData", bundle: Bundle.module, comment: "The data \(name) is missing from the response"), name)
59+
case let .invalidRequest(message):
60+
return message
5461
}
5562
}
5663

0 commit comments

Comments
 (0)