Skip to content

YunKi-H/WeatherPlan

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

45 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

2024-NC2-A14-WeatherKit

๐ŸŽฅ Youtube Link

WeatherKit

๐Ÿ’ก 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 prototype2

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

๐Ÿ› ๏ธ About Code

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> ํ˜•์‹์˜ ๋ฐ์ดํ„ฐ์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ ํŽธํ•˜๊ฒŒ [DayWeather] ํ˜•์‹(๋ฐฐ์—ด)์œผ๋กœ ๋ณ€ํ™˜
	let dayWeathers = weatherData.forecast
	
	/// ๋ฐ์ดํ„ฐ ๋ฐฐ์—ด์—์„œ ์›ํ•˜๋Š” ์ •๋ณด๋ฅผ ๋ฝ‘์•„ ์‚ฌ์šฉ
	for dayWeather in dayWeathers {
		print(dayWeather.lowTemperature.value) // ์ตœ์ €๊ธฐ์˜จ
	}
}

๐Ÿ› ๏ธ Before you Build

Before you run this project in Xcode:

  1. Download, install, and launch the latest version of Xcode.
  2. In Safari, visit the Certificates, Identifiers, and Profiles section of the developer website.
  3. Select Identifiers and click the Add button to create a new App ID for WeatherPlan. Follow the steps until you reach the Register an App ID page.
  4. For the Bundle ID, select Explicit, and enter a unique bundle identifier. Use a reverse-DNS format for your identifier, as Preparing your app for distribution describes.
  5. Click the App Services tab, and select the WeatherKit checkbox.
  6. Complete the App ID creation process.
  7. Wait 30 minutes while the service registers your appโ€™s bundle ID.
  8. In Xcode, from the Project navigator, select the WeatherPlan project and click the Signing & Capabilities tab.
  9. Enter the unique bundle ID from step 4 in the Bundle Identifier field of the WeatherKit target.
  10. From the scheme pop-up menu, select a run destination.
  11. If necessary, click Register Device on the Signing & Capabilities tab to create the provisioning profile.
  12. On the toolbar, click Run, or choose Product > Run.

About

Gureum & Pawn - WeatherKit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%