Guides

SwiftUI – How To Handle User Input Tutorial



In this SwiftUI video, you’ll implement the users favorites list using a model and binding it to the view so that the views automatically update when the data in the model changes.

I’m following and learning from Apple’s own SwiftUI tutorials and I highly recommend that you give them a read as well:
⚡ https://developer.apple.com/tutorials/swiftui/handling-user-input

I’ll be publishing more SwiftUI content and tutorials in the coming days so make sure you’re subscribed and you won’t miss a beat:
⚡https://www.youtube.com/user/codewithchris?sub_confirmation=1

SwiftUI is a new declarative framework to build user interfaces for apps across all of Apple’s platforms including iOS and the new iPadOS.

I’m super excited about Swift UI because it addresses the biggest concern I had with teaching programmatic UIs to beginners: that they would get lost and get discouraged.

SwiftUI is both intuitive and easy to grasp and it offers the maintainability and flexibility of a UI built with code. I’m going to start adopting it into my beginner material and I think you guys are going to really like it!

#swiftui #codewithchris

16 Comments

  • CodeWithChris

    QOTD ⚡Do you think SwiftUI is easy to understand? I've heard mixed sentiments. Let me know what your thoughts are below!?
    Kick start your own app with my free 7 Day App Action Plan ➡️ http://bit.ly/7dplan

  • Håkan Bergström

    Hi Chris! I noticed you hade a different solution than in the tutorial. In UserData you conform to the BindableObject while the tutorial conforms to ObservableObject. Have they updated the tutorial since you made the video or what's the reason for those differences? I'm new to both Xcode and SwiftUI so my head is about to explode 🙂

  • Stark Leadership

    HI Chris, I'm stuck at 15:32 of your video. I think something changes with Xcode 11 Beta 5 that was release on July 29th, as I receive a critical error "Unable to infer complex closure return type; add explicit type to disambiguate" when adding the ForEach statement. Tried following your video and again following the apple tutorial and the code is verbatim but I receive the error. Has something changed with Beta 5? if so will you be releasing an updated video?

  • linnhuangsap linnhuangsap

    Thanks a lot for explaining the difference between Apple's starting point file vs. where we left from the previous tutorial!! Ahhhh was struggling on this.

  • ayane may

    Thank you for this video. When I first learned about swiftUI, I was desperate – I just finished 2 courses on swift and it was all for nothing? But no, we still use all that, even if some of them have really changed their syntax look(and that's really sad for our memory). I feel that they could have made swiftUI syntax more like swift – I mean not change uilableview to Text, and things like that. It's like I am learning completely different mobile development) but without learning swift first and going thorough all your courses I wouldn't have understood at all this. And what it says about SwiftUI that even with Chris explaining I have to rewatch this) Thankfully Chris knows how to explain things)

  • Tristan Coe

    Always exciting to code along and once again, great tutorial. One thing, the stars are not really showing here. I finished the tutorial until the end, and I checked and rererechecked 🙂 and the code looks alike. might it be, because I am not using Catalina and only the new Xcode version? Therefore I don't get previews yes, but might there lie the missing star issue? cheers

  • Music On

    I am not talking about swiftUi but when I create an app on iPhone X and put correct constraints the also when I see it on a smaller phone I can hardly see what is at the down side or at the very top of what I created . please help Chris

    But yeah you are the most educated tutor on youtube I believe … good job

  • marshall branin

    For me, the stars only visually appear on the SE, on both the X simulator and my own personal iPhone X, they're not there.

  • TheSpiralnotizblock

    For a beginner its some like a overflow of informations. I worked already with UIKit and watched some Videos of SwiftUI. Both of them are very intressting. What should I focus more on it, SwiftUI or UIKit?
    You are already a programmer with
    several years of experience. What would you say?
    PS: You videos are awesome!

  • sminkly

    Hi. Thanks for the video. I have a question though. The landmark list checks the isfavorite of each landmark to determine whether to show it or not. Should the userData not control that ? ie the landmark list just tells the userdata model that it wants the favourites and the userdata then updates the landmark array that the landmark list uses. This way the view(landmark list) knows nothing about the data. From my limited understanding that is 'correct' way. I may have this completely wrong and perhaps this isn't the way the combine framework is meant to work.

  • Gjermund Gusland Thorsen

    Nice video, but how would one implement `.debounce( millisecondsIntValueForHowLongTheButtonWillBeParalyzedAfterLastPressed )` in which is of the essence to good U/X of buttons calling async functions; a like button as example. Sometimes it's wiser to make the app autonomous while syncing when there is connection to internet, however I see a lot of people making UI calling REST APIs directly, and for this `.debounc()` is imperative. A non-blocking wait inside the `Button( action: {} )`

  • Eduardo Tavares

    Why do you put .navigationBarTitle on the list closing brace instead of the navigation closing brace where it would make more sense?

  • DEV1L666

    You have so many swift tutorials. I want to build an app for school and later export it to my iPhone. I know some basic stuff and want to work with real xcode and not playground. With which video should I start?

  • Alpha Visari

    I have about 40 videos and bookmarked save to read and learn once I get on SwiftUI, this get on that list as well 😛 actually been nice for me as a newbie that so many is making up to date beginner guides 😀

Leave a Reply

Your email address will not be published. Required fields are marked *