How to build an iOS Streaks App and Widget

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 มิ.ย. 2023
  • In this video, you’ll learn how I built a streaks app with a complimentary iOS widget and how I kept the data in sync using App Groups. You’ll also learn about iOS widgets and how they work.
    👋 Our "Launch Your First App" program will help you build up your iOS skills to publish your very own feature rich app even if you’re a beginner starting from scratch. cwc.to/youtubeoffer
    Links and references from the video:
    - CWC+: codewithchris.com/plus
    - Timeline Provider: developer.apple.com/documenta...
    - AppIntents:developer.apple.com/documenta...
    - Keeping a widget up to date: developer.apple.com/documenta...
    - @KavSoft Circular Progress Ring: • SwiftUI 3.0 Apple Bed ...
    Steps:
    00:56 Start the Xcode project
    01:21 Add the counter and button
    03:26 Build the progress ring
    08:53 Style the text and background
    12:02 Add a widget extension
    13:53 Walkthrough of the Widget code
    25:33 Set up an App Group
    29:49 Set up the DataService in the Widget
    31:35 Build the Widget UI
    38:07 Manually update the widget from the app
    39:37 Add an app intent to the project

ความคิดเห็น • 24

  • @CodeWithChris
    @CodeWithChris  หลายเดือนก่อน

    👋 Our "Launch Your First App" program will help you build up your iOS skills to publish your very own feature rich app even if you’re a beginner starting from scratch. cwc.to/youtubeoffer

  • @danielcrompton7818
    @danielcrompton7818 16 วันที่ผ่านมา

    Hey Chris a tip with the autocomplete: any time you want to toggle it on/off (with cursor in the correct place eg. StrokeStyle(| press ESC

  • @alinazhusupbekova9852
    @alinazhusupbekova9852 27 วันที่ผ่านมา

    Thanks for the tutorial! Could youmake a video about getting user location on widget interaction (e.g. button tap)?

  • @reactnative4749
    @reactnative4749 3 หลายเดือนก่อน

    Thanks

  • @YugaSamuel
    @YugaSamuel 2 หลายเดือนก่อน

    Hi Chris, would it be possible to create a button to refresh the widget, but also at the same time, a timeline to keep the widget up-to-date? If I click the refresh button, would the timelines reseted?

  • @SuperWombus
    @SuperWombus 10 หลายเดือนก่อน

    Thanks for this Chris! Got everything working except for the AppIntent at the end to increment the streak count when tapping on the widget. When I tap on the widget it just loads the full app. I’m gonna circle back though and confirm I didn’t miss anything

    • @CherryKing414
      @CherryKing414 9 หลายเดือนก่อน

      Me too. How to fix.😂

    • @CherryKing414
      @CherryKing414 9 หลายเดือนก่อน

      I solved it. like this
      Button(intent: AppIntent()) { ... } // If has AppIntent(),tap on the widget not loads the full app.

  • @aydinjoshi
    @aydinjoshi 9 หลายเดือนก่อน +2

    my app group container is staying red in signing and capabilities

  • @ProVokeGames
    @ProVokeGames ปีที่แล้ว

    I have a decent understanding of UIKit having taken Angela Yu's course 3 years ago. I've recently got that itch to get back into Swift and try to dive deeper into SwiftUI now that it's had time to mature. Do you think it's worth delving deep into SwiftUI to try and land that work from home job as a SwiftUI dev with some pretty basic UIKit understanding (Classes, structs, API's etc). Or would mastering UIKit and then move onto SwiftUI be what I should be focusing on? I'm just trying get that dev job in the next 3 months really diving into this and am worried I might kinda waste my time when I could be focusing on the future of SwiftUI. Any insight would be fantastic. Thank you Chris and keep up the great videos!

    • @VikramSingh-dt1yd
      @VikramSingh-dt1yd ปีที่แล้ว

      I'm not Chris, but I thought I'd share what I would do in your situation (I also started with Angela Yu's course and am now a full time iOS Engineer at Lyft!).
      If your top priority is landing an iOS Developer job, I would start learning SwiftUI just because it's another skill on your resume (and will open many more doors than mastering UIKit would). Most of the iOS community agrees that SwiftUI will become a large part of the future of iOS development (if not already). Mastering UIKit now would certainly prove useful, but those skills will inevitably become less and less valuable as the technologies begin to shift (in this case, it is better to start to learn technologies on the uprise imo).
      With that said, having UIKit skill/experience is very important since it is an imperative framework (where SwiftUI is declarative). If you don't understand what this distinction means, I implore you to look into it (it may even help you in an interview one day). Even if SwiftUI takes over, UIKit will pop up now and again, so make sure that you are still skilled with the UIKit fundamentals.

    • @CodeWithChris
      @CodeWithChris  ปีที่แล้ว +2

      In our opinion, majority of companies (like 95% of em) still have their apps codebase written in UIKit, and a few (about 30%) are slowly transitioning into SwiftUI. The reason that there is a friction to adoption is that companies wanted to cover as much userbase as possible, and to do that they have to support older versions of iOS.
      You're also correct that SwiftUI is the future, and that Apple is clearly pushing it on every WWDC, but each improvement they do to SwiftUI is only available to the iOS version coming out that year, and it isn't backwards compatible to older versions of iOS, which is why companies can't easily make the transition or simply adopt SwiftUI at 100% of their codebases.
      So your goal of refreshing your UIKit knowedge is on track if you wanted to get employed as a developer. If you land a job, that may be the best time to learn SwiftUI unless the position specifically requires SwiftUI knowledge right off the job posting. - Pat

  • @user-op8sb2qo1o
    @user-op8sb2qo1o 3 หลายเดือนก่อน

    Hello Chris
    I want to have multiple widgets under same target. Can you help me with the same?

  • @patrikurban5261
    @patrikurban5261 9 หลายเดือนก่อน +3

    in ios 17 containerBackground not working for me

    • @punchafeng6268
      @punchafeng6268 9 หลายเดือนก่อน

      It should be working. XCode generated containerBackground() call for you, so you must delete it first.

    • @bobinou
      @bobinou 8 หลายเดือนก่อน

      did you get it working?

  • @EmanNollase
    @EmanNollase ปีที่แล้ว

    noob question here, is the widget deployed along with the app in the appstore?

    • @CodeWithChris
      @CodeWithChris  ปีที่แล้ว +2

      Hello @EmanNollase
      Yes, when you deploy your app to the App Store, the widget comes along with it.
      The widget system uses the same easy WidgetKit API across various environments such as the Home screen, Lock screen, StandBy mode on iPhone, Smart Stack on Apple Watch, and desktop on Mac, allowing your widget to be automatically adaptable to these different locations. So, when you publish your app to the App Store, the widget included in your app will be deployed along with it. The viewers of your widget will depend on the device they are using, and the context in which they choose to use it.
      Resource: Bring widgets to new places [developer.apple.com/videos/play/wwdc2023/10027/]
      --Joash

    • @EmanNollase
      @EmanNollase ปีที่แล้ว +1

      @@CodeWithChris thanks...i am planning to add widget to the app i am currently developing..thanks for the tutorial!

    • @CodeWithChris
      @CodeWithChris  ปีที่แล้ว +1

      Wishing you the best of luck on your app, @EmanNollase!
      --Joash

  • @designckinet
    @designckinet ปีที่แล้ว

    Nice job 👍

  • @geoffreyh9635
    @geoffreyh9635 ปีที่แล้ว

    😠 *Promosm*