From 1c872e9822083c1ee041e1f9744f107acb8556c3 Mon Sep 17 00:00:00 2001 From: JasonYang Date: Tue, 6 Feb 2024 12:29:27 +0900 Subject: [PATCH] =?UTF-8?q?[Settings]#4-Dev=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Weather777/Info.plist | 2 +- Weather777/Network/WeatherManager.swift | 1 + Weather777/Network/WeatherModel.swift | 60 +++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/Weather777/Info.plist b/Weather777/Info.plist index db79e33..d6d2549 100644 --- a/Weather777/Info.plist +++ b/Weather777/Info.plist @@ -3,7 +3,7 @@ NSLocationWhenInUseUsageDescription - App needs location servers for stuffs. + App needs location servers for stuff. UIApplicationSceneManifest UIApplicationSupportsMultipleScenes diff --git a/Weather777/Network/WeatherManager.swift b/Weather777/Network/WeatherManager.swift index 0241a8c..8c0bc83 100644 --- a/Weather777/Network/WeatherManager.swift +++ b/Weather777/Network/WeatherManager.swift @@ -6,3 +6,4 @@ // import Foundation + diff --git a/Weather777/Network/WeatherModel.swift b/Weather777/Network/WeatherModel.swift index 2426160..4a4b413 100644 --- a/Weather777/Network/WeatherModel.swift +++ b/Weather777/Network/WeatherModel.swift @@ -6,3 +6,63 @@ // import Foundation + +// MARK: - WeatherData +struct WeatherData: Codable { + let coord: Coord + let weather: [Weather] + let base: String + let main: Main + let visibility: Int + let wind: Wind + let clouds: Clouds + let dt: Int + let sys: Sys + let timezone, id: Int + let name: String + let cod: Int +} + +// MARK: - Clouds +struct Clouds: Codable { + let all: Int +} + +// MARK: - Coord +struct Coord: Codable { + let lon, lat: Double +} + +// MARK: - Main +struct Main: Codable { + let temp, feelsLike, tempMin, tempMax: Double + let pressure, humidity: Int + + enum CodingKeys: String, CodingKey { + case temp + case feelsLike = "feels_like" + case tempMin = "temp_min" + case tempMax = "temp_max" + case pressure, humidity + } +} + +// MARK: - Sys +struct Sys: Codable { + let type, id: Int + let country: String + let sunrise, sunset: Int +} + +// MARK: - Weather +struct Weather: Codable { + let id: Int + let main, description, icon: String +} + +// MARK: - Wind +struct Wind: Codable { + let speed: Double + let deg: Int +} +