Skip to content

Commit e760883

Browse files
committed
Added UV index and time
1 parent 6e327f0 commit e760883

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Source/DataPoint.swift

+12
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ public struct DataPoint {
107107
/// The columnar density of total atomspheric ozone at the given time in Dobson units.
108108
public let ozone: Float?
109109

110+
/// The UV index.
111+
public let uvIndex: Float?
112+
113+
// The time at which the maximum UV index occurs during the given day.
114+
public let uvIndexTime: Date?
115+
110116
/// Creates a new `DataPoint` from a JSON object.
111117
///
112118
/// - parameter json: A JSON object with keys corresponding to the `DataPoint`'s properties.
@@ -181,5 +187,11 @@ public struct DataPoint {
181187
pressure = json["pressure"] as? Float
182188
visibility = json["visibility"] as? Float
183189
ozone = json["ozone"] as? Float
190+
uvIndex = json["uvIndex"] as? Float
191+
if let jsonUVIndexTime = json["uvIndexTime"] as? Double {
192+
uvIndexTime = Date(timeIntervalSince1970: jsonUVIndexTime)
193+
} else {
194+
uvIndexTime = nil
195+
}
184196
}
185197
}

0 commit comments

Comments
 (0)