Commit e13f57af by Demid Merzlyakov

Save UV index to CoreData.

parent fb670756
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<attribute name="temp" optional="YES" attributeType="Binary"/> <attribute name="temp" optional="YES" attributeType="Binary"/>
<attribute name="timeZone" attributeType="String"/> <attribute name="timeZone" attributeType="String"/>
<attribute name="type" attributeType="String"/> <attribute name="type" attributeType="String"/>
<attribute name="uv" optional="YES" attributeType="Decimal" defaultValueString="0"/>
<attribute name="visibility" optional="YES" attributeType="Binary"/> <attribute name="visibility" optional="YES" attributeType="Binary"/>
<attribute name="weekDay" attributeType="String"/> <attribute name="weekDay" attributeType="String"/>
<attribute name="windDirection" optional="YES" attributeType="String"/> <attribute name="windDirection" optional="YES" attributeType="String"/>
...@@ -126,7 +127,7 @@ ...@@ -126,7 +127,7 @@
<elements> <elements>
<element name="CoreAirQuality" positionX="438.48828125" positionY="-201.96875" width="128" height="88"/> <element name="CoreAirQuality" positionX="438.48828125" positionY="-201.96875" width="128" height="88"/>
<element name="CoreAppData" positionX="114.79296875" positionY="-494.5078125" width="128" height="73"/> <element name="CoreAppData" positionX="114.79296875" positionY="-494.5078125" width="128" height="73"/>
<element name="CoreCurrentWeather" positionX="-105.953125" positionY="-203.82421875" width="128" height="433"/> <element name="CoreCurrentWeather" positionX="-105.953125" positionY="-203.82421875" width="128" height="448"/>
<element name="CoreDailyWeather" positionX="270.5546875" positionY="-505.83203125" width="128" height="313"/> <element name="CoreDailyWeather" positionX="270.5546875" positionY="-505.83203125" width="128" height="313"/>
<element name="CoreHealth" positionX="277.1640625" positionY="-156.77734375" width="128" height="103"/> <element name="CoreHealth" positionX="277.1640625" positionY="-156.77734375" width="128" height="103"/>
<element name="CoreHourlyWeather" positionX="279.15234375" positionY="-29.234375" width="128" height="253"/> <element name="CoreHourlyWeather" positionX="279.15234375" positionY="-29.234375" width="128" height="253"/>
......
...@@ -27,6 +27,7 @@ open class CoreCurrentWeather: _CoreCurrentWeather, CoreDataAppModelConvertable ...@@ -27,6 +27,7 @@ open class CoreCurrentWeather: _CoreCurrentWeather, CoreDataAppModelConvertable
result.visibility = try CoreDataUtils.measurement(from: self.visibility, in: self, attributeName: "visibility") result.visibility = try CoreDataUtils.measurement(from: self.visibility, in: self, attributeName: "visibility")
result.pressure = try CoreDataUtils.measurement(from: self.pressure, in: self, attributeName: "pressure") result.pressure = try CoreDataUtils.measurement(from: self.pressure, in: self, attributeName: "pressure")
result.uv = self.uv?.intValue
result.sunrise = self.sunrise result.sunrise = self.sunrise
result.sunset = self.sunset result.sunset = self.sunset
result.sunState = try CoreDataUtils.appValueOptional(name: "sunState", value: self.sunState, in: self) result.sunState = try CoreDataUtils.appValueOptional(name: "sunState", value: self.sunState, in: self)
...@@ -71,6 +72,9 @@ open class CoreCurrentWeather: _CoreCurrentWeather, CoreDataAppModelConvertable ...@@ -71,6 +72,9 @@ open class CoreCurrentWeather: _CoreCurrentWeather, CoreDataAppModelConvertable
self.visibility = try CoreDataUtils.measurementToData(appModel.visibility, in: self, attributeName: "visibility") self.visibility = try CoreDataUtils.measurementToData(appModel.visibility, in: self, attributeName: "visibility")
self.pressure = try CoreDataUtils.measurementToData(appModel.pressure, in: self, attributeName: "pressure") self.pressure = try CoreDataUtils.measurementToData(appModel.pressure, in: self, attributeName: "pressure")
if let uv = appModel.uv {
self.uv = NSDecimalNumber(value: uv)
}
self.sunrise = appModel.sunrise self.sunrise = appModel.sunrise
self.sunset = appModel.sunset self.sunset = appModel.sunset
self.sunState = appModel.sunState?.rawValue self.sunState = appModel.sunState?.rawValue
......
...@@ -26,6 +26,7 @@ public enum CoreCurrentWeatherAttributes: String { ...@@ -26,6 +26,7 @@ public enum CoreCurrentWeatherAttributes: String {
case temp = "temp" case temp = "temp"
case timeZone = "timeZone" case timeZone = "timeZone"
case type = "type" case type = "type"
case uv = "uv"
case visibility = "visibility" case visibility = "visibility"
case weekDay = "weekDay" case weekDay = "weekDay"
case windDirection = "windDirection" case windDirection = "windDirection"
...@@ -130,6 +131,9 @@ open class _CoreCurrentWeather: NSManagedObject { ...@@ -130,6 +131,9 @@ open class _CoreCurrentWeather: NSManagedObject {
var type: String! var type: String!
@NSManaged open @NSManaged open
var uv: NSDecimalNumber?
@NSManaged open
var visibility: Data? var visibility: Data?
@NSManaged open @NSManaged open
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment