Blame view

HDFwear/Home/Model/NewWeatherModel.swift 2.18 KB
b05829d0   jason   feat:set weather
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
  //
  //  NewWeatherModel.swift
  //  HDFwear
  //
  //  Created by admin on 2023/11/14.
  //
  
  import UIKit
  import HandyJSON
  import SwiftDate
  
  enum NewWeatherType: Int, HandyJSONEnum {
      case sunny = 1
      case cloudy = 2
      case overcast = 3
      case rain = 4
      case snow = 5
      case smog = 6
      case hail = 7
  }
  
  enum NewAirQuality: Int, HandyJSONEnum {
      case you = 1
      case liang = 2
      case qingdu = 3
      case moderate = 4
      case zhongdu = 5
      case yanzhong = 6
  }
  
  enum NewWindType: Int, HandyJSONEnum {
      case east = 1
      case south = 2
      case west = 3
      case north = 4
      case southeast = 5
      case northeast = 6
      case southwest = 7
      case northwest = 8
  }
  
  class NewNextWeatherModel: NSObject, HandyJSON {
      required override init() { }
      var highestTemperature: Int = 0
      var lowestTemperature: Int = 0
      var type: NewWeatherType = .sunny
      
      init(highestTemperature: Int, lowestTemperature: Int, type: NewWeatherType) {
          self.highestTemperature = highestTemperature
          self.lowestTemperature = lowestTemperature
          self.type = type
      }
  }
  
  class NewWeatherModel: NSObject, HandyJSON {
      required override init() { }
      
      var date: Date?
      var currentTemperature: Int = 0
      var highestTemperature: Int = 0
      var lowestTemperature: Int = 0
      var type: NewWeatherType = .sunny
      var airQuality: NewAirQuality = .you
      var humidity: Int = 0
      var wind: NewWindType = .east
      var windForce: Int = 0
      var next5Days: Array<NewNextWeatherModel> = []
      var position: String = ""
      
      init(date: Date? = Date(), currentTemperature: Int, highestTemperature: Int, lowestTemperature: Int, type: NewWeatherType, airQuality: NewAirQuality, humidity: Int, wind: NewWindType, windForce: Int, next5Days: Array<NewNextWeatherModel>, position: String) {
          self.date = date
          self.currentTemperature = currentTemperature
          self.highestTemperature = highestTemperature
          self.lowestTemperature = lowestTemperature
          self.type = type
          self.airQuality = airQuality
          self.humidity = humidity
          self.wind = wind
          self.windForce = windForce
          self.next5Days = next5Days
          self.position = position
      }
  }