1. WeatherKit: Introduction and CurrentWeather Conditions

Поделиться
HTML-код
  • Опубликовано: 19 июл 2024
  • WeatherKit provides timely weather information including current conditions, minute precipitation, along with hourly, and daily forecasts. It also provides severe weather alerts.
    In this series we will be building a personal Weather application.
    Of course, there are better applications out there, including Apple's own Weather application so why would you want to build your own.
    Well, if you are creating an application that includes different destinations like a travel app or one that uses MapKit, you might want to include the ability to check out the weather in those locations either now, or get the forecast for the next 24 hours for the the next 10 days.
    WeatherKit offers valuable weather data for your apps and services to help people stay up to date on the latest conditions.
    By the end of this series, you will be able to do that.
    If you want to support my work, you can buy me a coffee :)
    ko-fi.com/stewartlynch
    Table of Contents:
    0:00 Introduction
    1:08 Application Demo
    3:02 New Application and Enabling WeatherKit
    6:52 WeatherManager Class
    11:05 ForecastView
    19:14 Attribution
    Starter Project Branch:
    None
    Completed Branch:
    github.com/StewartLynch/MyWea...
    WeatherKit Series Playlist
    Other links mentioned in video:
    ******* Download my StewartLynch RUclips Channel Application - Free **********
    stewartlynch.gumroad.com/l/obsjz
    Other Affiliate links
    BigMountain Studio Books
    SwiftUI Views Mastery
    www.bigmountainstudio.com/vie...
    SwiftUI 5 Book Bundle
    www.bigmountainstudio.com/boo...
    Combine Mastery in SwiftUI
    www.bigmountainstudio.com/com...
    Core Data Mastery in SwiftUI
    www.bigmountainstudio.com/cor...
    SwiftUI Animations Mastery
    www.bigmountainstudio.com/ani...
    AppCoda Books
    Beginning iOS 16 Programming with Swift (SwiftUI + UIKit)
    gumroad.com/a/646790611/WihuX
    Beginning iOS 16 Programming with Swift (SwiftUI + UIKit) - Starter
    gumroad.com/a/646790611/mOzKq
    Mastering SwiftUI 4 + Swift Programming for iOS 16 - Professional
    gumroad.com/a/646790611/gjPBw
    Mastering SwiftUI 4 - Starter
    gumroad.com/a/646790611/TyNEz
    Other References:
    Stewart Lynch's RUclips Channel:
    / @stewartlynch
    Stewart Lynch on Mastodon:
    iosdev.space/@StewartLynch
    Stewart Lynch On Threads:
    @StewartLynch
    Stewart Lynch on X:
    x.com/StewartLynch
    Stewart Lynch on LinkedIn
    / stewartlynch
  • НаукаНаука

Комментарии • 19

  • @indianfyre
    @indianfyre Месяц назад

    All your videos are amazing Stewart, thank you! Will be watching keenly for the next few videos

  • @holycrosscv
    @holycrosscv 2 месяца назад

    Brilliant beginning, Stewart. So many helpful hints here. I look forward to the rest of the series. Thanks as always!

  • @abdouett3676
    @abdouett3676 2 месяца назад

    Great work! Thank you!

  • @tazman7689
    @tazman7689 Месяц назад

    Great video, look forward to the rest of the series. As always, well presented. I would like to know why the task is detached and really what it means to detach a task? With WeatherManager why is it a singleton and not an observable class, is there a benefit to that?

    • @StewartLynch
      @StewartLynch  Месяц назад

      I am following Apple’s example here

  • @schlumpfpapa6810
    @schlumpfpapa6810 2 месяца назад +1

    Hi, great Video.
    One question though:
    At 13 min 31 s in ForecastView's body's task modifier. If you set isLoading to false after the Task.detached, it would be executed immediately, wouldn't it?

  • @nickdev32
    @nickdev32 Месяц назад

    Hi Stewart, great video. Quick question - why do we need detached tasks that run on the main thread inside the task modifier? My understanding is that task modifier runs on the main thread already. And if the weather manager functions are already running on background threads, the task modifier should assign the values to your @State properties on the main thread. Lmk, thanks again!

    • @StewartLynch
      @StewartLynch  Месяц назад +1

      I was just following Apple’s example here.

  • @dibjr
    @dibjr 2 месяца назад

    Great Video! But weird! Your Vancouver temp when you recorded is the same as the Duluth, MN temp now!

  • @spiffylogic
    @spiffylogic Месяц назад

    23:25 can you explain how using the string initializer explicitly solves this issue?

    • @StewartLynch
      @StewartLynch  Месяц назад

      THe Text iew initializer’s default is a LocalizedStringKey so using the initializer (.init) converts the markdown to a localizedString

  • @Prashant-7
    @Prashant-7 2 месяца назад +1

    1) can you pl expalin why we use task.detached ? , 2) temperature property from response does contains C, F in it because i. can see MeasurementFormatter created but we did not pass anything that says it is temperature unit
    sorry if it is silly questions
    Thanks

    • @Prashant-7
      @Prashant-7 Месяц назад

      may be nonisolated func if we want to run code other than main actor ?
      May be I am missing something

    • @Prashant-7
      @Prashant-7 Месяц назад

      @StewartLynch Everyone gets answer other than me, may be i asked wrong question

  • @indiekiduk
    @indiekiduk 2 месяца назад

    The async tasks and formatting don’t seem standard SwiftUI and have bugs. Eg the loading spinner won’t show and the label won’t reformat on region settings change. If this is from the weaktherkit sample then sadly it’s common that these other teams don’t use SwiftUI correctly.

    • @Prashant-7
      @Prashant-7 Месяц назад

      async task whats wrong with that , is there any doc that you recommend ? asking because i want to learn best practices