Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/developeracademy-postech/2024-nc2-a14-weatherkit

Gureum & Pawn - WeatherKit
https://github.com/developeracademy-postech/2024-nc2-a14-weatherkit

swiftui weatherkit

Last synced: about 10 hours ago
JSON representation

Gureum & Pawn - WeatherKit

Awesome Lists containing this project

README

        

# 2024-NC2-A14-WeatherKit
## ๐ŸŽฅ Youtube Link
(์ถ”ํ›„ ๋งŒ๋“ค์–ด์ง„ ์œ ํŠœ๋ธŒ ๋งํฌ ์ถ”๊ฐ€)

## ๐Ÿ’ก About WeatherKit

> # **์œ„์น˜๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์—ฌ๋Ÿฌ ์ข…๋ฅ˜์˜ ๊ธฐ์ƒ ๋ฐ์ดํ„ฐ๋ฅผ ์ œ๊ณตํ•˜๋Š” ํ”„๋ ˆ์ž„ ์›Œํฌ**
>
> - Current weather -> ์ฒด๊ฐ ์˜จ๋„, ์Šต๋„, ์ž์™ธ์„ , ์ด์Šฌ์ 
> - Minute forecast -> ๊ฐ•์ˆ˜ ํ™•๋ฅ , ๊ฐ•์ˆ˜ ๊ฐ•๋„
> - Hourly forecast -> ์ฒด๊ฐ ์˜จ๋„, ์Šต๋„, ์ž์™ธ์„ , ์ด์Šฌ์ 
> - Daily forecast -> ์ตœ๊ณ  ๊ธฐ์˜จ, ์ตœ์ € ๊ธฐ์˜จ, ๋‹ฌ ํ˜•์ƒ, ๊ฐ•์ˆ˜๋Ÿ‰, ์ผ์ถœ, ์ผ๋ชฐ
> - Weather alerts -> ์ง€์—ญ, ์œ„ํ—˜๋„
> - Historical weather -> ์ฒด๊ฐ ์˜จ๋„, ์Šต๋„, ์ž์™ธ์„ , ์ด์Šฌ์ 

## ๐ŸŽฏ What we focus on?

> # Daily forecast - DayWeather
>
> - ์˜ท์ฐจ๋ฆผ ์ถ”์ฒœ / ๋‹ฌ ๋ชจ์Šต ๋ณด์—ฌ์ฃผ๊ธฐ / ๋น„ ์˜ค๋Š” ๋‚  ์•Œ๋ ค์ฃผ๊ธฐ / ์„ ํฌ๋ฆผ ๋ฐ”๋ฅด๋ผ๊ณ  ์•Œ๋ ค์ฃผ๊ธฐ ๋“ฑโ€ฆ
> - ๋‚ ์”จ๊ฐ€ ์•ˆ ์ข‹์„ ๋•Œ ๋‚˜๊ฐ€๊ธฐ ์‹ซ์–ดํ•˜๋Š” ๊ตฌ๋ฆ„๊ณผ ํฐ
> - ๋‚ ์”จ ์•ฑ๊ณผ ์ผ์ • ๊ธฐ๋ก ์•ฑ์„ ๋ฒˆ๊ฐˆ์•„๊ฐ€๋ฉฐ ๋ณด๋Š” ๊ฒƒ์ด ๋ถˆํŽธํ–ˆ๋˜ ์ƒํ™ฉ์— Engage
> - ์ผ์ •์„ ์ •ํ•˜๋Š” ๊ธฐ๋Šฅ๊ณผ ๋‚ ์”จ๋ฅผ ํ™•์ธํ•˜๋Š” ๊ธฐ๋Šฅ์„ ํ•จ๊ป˜ ์ œ๊ณตํ•˜์—ฌ ๋ถˆํŽธํ•จ์„ ์ค„์—ฌ๋ณด์ž!
> - ์ผ์ •์— ํฐ ์˜ํ–ฅ์„ ์ฃผ๋Š” ๋‚ ์”จ ์ •๋ณด๋Š” ๋ฌด์—‡์ผ๊นŒ?
> - ๋‚ ์งœ๋ณ„๋กœ ๋‚ ์”จ(๋Œ€ํ‘œ), ์ตœ๊ณ  ๊ธฐ์˜จ, ์ตœ์ € ๊ธฐ์˜จ, ๊ฐ•์ˆ˜ ์—ฌ๋ถ€, ์ž์™ธ์„ , ํ’์† ์ •๋ณด ์ œ๊ณต ํ•„์š”

## ๐Ÿ’ผ Use Case

> **WeatherKit์„ ํ™œ์šฉํ•ด [ ๋‚ ์”จ ํ™•์ธ๊ณผ ์ผ์ • ๊ด€๋ฆฌ๋ฅผ ํ†ตํ•ฉ ]์‹œ์ผœ**
>
>
> **[ ์„ ํ˜ธํ•˜์ง€ ์•Š๋Š” ๋‚ ์”จ์ธ ๋‚  ์ผ์ •์„ ์žก๊ธฐ๋ฅผ ๊บผ๋ คํ•˜๋Š” ์‚ฌ์šฉ์ž ] ๊ฐ€**
>
> **[ ๋‚ ์”จ๋ฅผ ๊ณ ๋ คํ•ด ์ผ์ •์„ ์žก์„ ๋•Œ ํŽธ๋ฆฌ ] ํ•˜๊ฒŒ ํ•ด์ฃผ๋Š” ์บ˜๋ฆฐ๋”**
>

## ๐Ÿ–ผ๏ธ Prototype

![prototype1](https://github.com/YunKi-H/2024-NC2-A14-WeatherKit/assets/80469941/dd1636e9-faa5-4c8b-b3fa-45ef321b8a8c)
![prototype2](https://github.com/YunKi-H/2024-NC2-A14-WeatherKit/assets/80469941/f13276cd-9738-4b73-92d1-c5fd07726907)

- ์‚ฌ์šฉ์ž์˜ ํ˜„์žฌ ์œ„์น˜ ๊ธฐ์ค€ ์˜ค๋Š˜ํฌํ•จ ์ดํ›„ ์—ดํ˜๊ฐ„ ๋‚ ์”จ ์ •๋ณด๋ฅผ ๋ณด์—ฌ์คŒ (์œ„์น˜ ๊ถŒํ•œ ์‚ฌ์šฉ ํ—ˆ์šฉ์‹œ)
- ๋‚ ์”จ ์ •๋ณด๊ฐ€ ์žˆ๋Š” ๋‚ ์งœ์˜ ์ฃผ์˜ํ• ๋งŒํ•œ ํŠน์ด์‚ฌํ•ญ์„ ์•Œ๋ ค์คŒ (๊ฐ•์ˆ˜, ์ถ”์œ„, ๋”์œ„, ์ผ๊ต์ฐจ, ๊ฐ•ํ’)
- ์ผ์ •์ด ์žˆ๋Š” ๋‚ ์—๋Š” ์ž‘์€ ์›ํ˜•์˜ ์ธ๋””์ผ€์ดํ„ฐ๊ฐ€ ํ‘œ์‹œ๋จ
- ์‚ฌ์šฉ์ž๊ฐ€ ์•ฝ์†์„ ์žก๊ธฐ ์ข‹์€ ๋‚ ์”จ์ธ ๋‚ ์„ ๊ณจ๋ผ์„œ ์ผ์ •์„ ์žก๊ธฐ ์ˆ˜์›”ํ•ด์ง

## ๐Ÿ› ๏ธ About Code

```swift
import WeatherKit // **์ค‘์š”**
import CoreLocation.CLLocation // ์›ํ•˜๋Š” ์ผ๋ถ€๋งŒ import ํ•˜๊ณ  ์‹ถ์„ ๋•Œ

/// Apple ์—์„œ ์ œ๊ณตํ•˜๋Š” ๋‚ ์”จ ์ •๋ณด ์ด๊ด„ ๊ฐ์ฒด
/// - WeatherService ๊ฐ์ฒด๋ฅผ ํ†ตํ•ด WeatherKit ์˜ ์ •๋ณด๋ฅผ ๋ถˆ๋Ÿฌ์˜ฌ ์ˆ˜ ์žˆ์Œ
/// - WeatherService ๋‚ด๋ถ€์˜ .shared ํ”„๋กœํผํ‹ฐ๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•จ (๋‹ค์ˆ˜ ๊ฐ์ฒด ์ƒ์„ฑ ๋ฐฉ์ง€)
let weatherService: WeatherService = WeatherService.shared

/// ๋‚ ์”จ ์ •๋ณด๋ฅผ ๋ฐ›์•„์˜ฌ ์œ„์น˜ (์˜ˆ์‹œ: C5 ์ขŒํ‘œ)
let location: CLLocation = CLLocation(latitude: 36.0135, longitude: 129.3263)

Task {
/// weatherService ๊ฐ์ฒด์˜ weather(...) ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•ด ๋‚ ์”จ ์ •๋ณด๋ฅผ ๋ฐ›์•„์˜ฌ ์ˆ˜ ์žˆ์Œ
/// .daily ์™ธ์—๋„ .alerts, .current, .availability, .minute, .hourly ๋“ฑ ์›ํ•˜๋Š” ์ข…๋ฅ˜์˜ ๋ฐ์ดํ„ฐ ํ˜ธ์ถœ ๊ฐ€๋Šฅ
/// ์™ธ๋ถ€ ๋ฐ์ดํ„ฐ ํ˜ธ์ถœ์ด๋ผ ๋น„๋™๊ธฐ ํ•จ์ˆ˜์ด๊ณ , Error ๋ฐœ์ƒ ๊ฐ€๋Šฅํ•˜๊ธฐ ๋•Œ๋ฌธ์— [try, await] ํ‚ค์›Œ๋“œ ์‚ฌ์šฉ ํ•„์š”
let weatherData = try? await weatherService.weather(for: location, including: .daily)
/// ๋ฐ›์•„์˜จ Forecast ํ˜•์‹์˜ ๋ฐ์ดํ„ฐ์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ ํŽธํ•˜๊ฒŒ [DayWeather] ํ˜•์‹(๋ฐฐ์—ด)์œผ๋กœ ๋ณ€ํ™˜
let dayWeathers = weatherData.forecast

/// ๋ฐ์ดํ„ฐ ๋ฐฐ์—ด์—์„œ ์›ํ•˜๋Š” ์ •๋ณด๋ฅผ ๋ฝ‘์•„ ์‚ฌ์šฉ
for dayWeather in dayWeathers {
print(dayWeather.lowTemperature.value) // ์ตœ์ €๊ธฐ์˜จ
}
}
```