Create a List of Todo items in SwiftUI | Todo List #1

  Рет қаралды 64,452

Swiftful Thinking

Swiftful Thinking

Күн бұрын

We will kick-off the app by creating the main screens! In this video we will focus on SwiftUI logic to build out the views where users can manage the Todo List and add new items. In MVVM (Model-View-ViewModel architecture), the View layer is strictly responsible for the UI (user interface) of the application. Therefore, the view has all of the UI components but none of the logic for downloading/uploading/saving data.
Next video: • Create a custom data m...
Last video: • Build Todo List in Swi...
🤙 WELCOME BACK 🤙
WEBSITE: www.swiftful-t...
DISCORD: / discord
GITHUB: github.com/Swi...
SAY THANKS: www.buymeacoff...

Пікірлер: 104
@dugrut1325
@dugrut1325 2 жыл бұрын
Back in the day, when people / offices first got computers at their desks I taught the elementary of howto use and what you could do on a computer to make their life/work productive. From how to use a mouse, email, word processing, etc. Teaching is an art form, you may have all the knowledge stored in your own tiny little brain and your are so excited to tell others but to convey that information so that light bulb goes off in their brain is a whole other world. It took me months to figure out what worked and what didn't work. Nick you have discovered it, you are an amazing teacher.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Wow! Thanks Douglas. I learned to code online too and now I'm just trying to make it as easy as possible for others :)
@dugrut1325
@dugrut1325 2 жыл бұрын
I watched you whole Bootcamp series, took notes. I was excited to get started. Well brain fog set in. I couldn't even get a ZStack to work, let alone to get backGroundColor to work. Back to Video #1, I'll set in front of Xcode while I'm watching, fingers posed over the keyboard. It's not fun getting old.
@luberalexanderechavarriabe4156
@luberalexanderechavarriabe4156 2 жыл бұрын
Man, you have the skill to teach, sometimes there are a lot of people with so much knowledge bud they are not good to pass it to others.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Haha thanks for the comment! 👍
@luberalexanderechavarriabe4156
@luberalexanderechavarriabe4156 2 жыл бұрын
@@SwiftfulThinking Not worries. I just wanted to ask you if you have any video that shows you how to click the ticks and unclick them. Thanks a lot for any information
@doraemon7092
@doraemon7092 Жыл бұрын
when you find you tyoe ".background Color(colorLiteral()) " not work in xcode14 . You can define " @State var someColor = #colorLiteral()" ,then in " .background(Color(someColor))" to use it..
@eulicewinston
@eulicewinston Жыл бұрын
Very useful, thank you!!
@cameronbrown32
@cameronbrown32 9 ай бұрын
You're a hero. This has been driving me crazy for weeks in Xcode 15.1 and now 15.2. So just a heads up to anyone that shows up in one of those versions, it still works. Doesn't show all the choice types he uses in the video, but at least you get the picker.
@thecodingdevRahul
@thecodingdevRahul 2 ай бұрын
Helpfull
@yuchen3587
@yuchen3587 2 жыл бұрын
I went through a Stanford Swift course and learned nothing. Your tutorial is much much better than that!
@bbulliard
@bbulliard 2 жыл бұрын
Really like the way you code segregating everything so very neatly.. you are a very good and skilled teacher. Thank you for the video
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Writing clean code is half the battle! 😇
@LucianoClassicalGuitar
@LucianoClassicalGuitar 10 ай бұрын
Awesome intro music 😂 Makes the SwiftUI a little more fun
@muhammadusman-vc5re
@muhammadusman-vc5re Жыл бұрын
May GOD bless on you for this comprehensive effort.
@dorzlatan
@dorzlatan 3 жыл бұрын
Great job, mate! Continue!!!
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Hey Dorian! Thanks for watching :)
@warrenscorner
@warrenscorner Жыл бұрын
Wow! You really zip through this stuff. I'm gonna have to watch a few times.
@BombobongTV
@BombobongTV Жыл бұрын
the best make todolist video ever. thank you so much from south korea :)
@relaxingvibes5560
@relaxingvibes5560 2 жыл бұрын
Thank you for explaining MVVM!! Even google results too complicated for me lol
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Glad this helped!!
@ДмитрийКоновалов-я3у
@ДмитрийКоновалов-я3у 3 жыл бұрын
you a great human! Thanks! if you press option+command + P = resume canvas , it will get a little easier
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Thanks for the tip :)
@sema_f
@sema_f 3 жыл бұрын
I'm glad I found this channel! …after all the playground stuff this is my first dare to try it in Xcode 🥳
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
You can do it!
@vedangm3428
@vedangm3428 2 жыл бұрын
Were color literals phased out of the newer xcode? I don't see that in my completions menu at all.
@maguirer
@maguirer 3 жыл бұрын
Whoa... Multiple files! We're not in Kansas anymore! 😁
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
🤣🤣🤣 We started off easy but it does have to get a little more complex now haha
@nevemra5
@nevemra5 Жыл бұрын
Thank you very much for this video!
@bbulliard
@bbulliard 2 жыл бұрын
Very nice video. Well explained and world class! Thank you for putting this together....Bob
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thank you Bob! 😄
@sdlaker8397
@sdlaker8397 2 жыл бұрын
Thanks for this series! Is there a way to do this but with multiple columns? Say you wanted a list of items and their quantities that you then wanted to add up at the bottom?
@AndyJMacLeod
@AndyJMacLeod 2 жыл бұрын
Yes… I need to do something like this too in my app. My thoughts are: render each row of the table as an HStack.
@Stevesvideoshelf
@Stevesvideoshelf 3 жыл бұрын
Great start to an exciting project! I'm looking forward to taking all your courses. I really want to upgrade to Xcode 13. do you know if that would introduce problems while following your lessons?
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
There are a few small api changes, but nothing should really be blocking. Xcode 13 should be fine - I'm going to use it in my next course!
@Xruba1981
@Xruba1981 2 жыл бұрын
The only issue you might notice while following this course with XCode 13 is the colorLiteral (and imageLiteral) auto-completions are gone :( I use #colorLiteral( on a new line and then copy to Color() and it works, but it's not that convenient any more.
@thomasipad7719
@thomasipad7719 3 жыл бұрын
Is the source code available somewhere? I tried to rewrite that and am stuck: The line with ".navigationBarItems" produces the error: Value of type 'some View 'has no member 'navigationBarItems' :-O No idea why ...
@irfanrizvi161
@irfanrizvi161 3 жыл бұрын
Great one Nick. Always noticed using Text("Save".uppercased()) instead of typing Text("SAVE"), any particular reason for this? :-)
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Hahaha no, just a habit. In production apps, a lot of the time you don't actually have "Save" but instead you're referencing the String from a variable somewhere else in the code. So in that case, I like to just make sure it's all capitalized :)
@franjoeric4017
@franjoeric4017 2 жыл бұрын
Sometimes you'll have some translation file where will you have key save: "Save" , and that key translations.save will be used on more places, and you'll probably sometimes need Save, sometimes SAVE and sometime save as end result...
@TarunReddy_RM
@TarunReddy_RM 2 жыл бұрын
because navigation bar items have been deprecated im trying to use .toolbar. My problem is that i cant get the buttons to be aligned properly as it doesnt take an alignment parameter.. any tips?
@TarunReddy_RM
@TarunReddy_RM 2 жыл бұрын
.toolbar { ToolbarItemGroup(placement: ToolbarItemPlacement.navigationBarLeading) { Button { //code here } label: { Text("Edit") } } ToolbarItemGroup(placement: ToolbarItemPlacement.navigationBarTrailing) { Button { //code here } label: { Text("Add") } } }
@TarunReddy_RM
@TarunReddy_RM 2 жыл бұрын
This is how I was able to fix it if anyone's interested
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Agreed. Toolbar is the way to go now. I believe they're shifting away from the original nav bar items because the toolbar is more dynamic across different devices.
@manfredkernMK
@manfredkernMK Жыл бұрын
@@SwiftfulThinking This worked for me: .toolbar { ToolbarItem(placement: .navigationBarLeading) { EditButton() } ToolbarItem(placement: .navigationBarTrailing) { NavigationLink("Add", destination: AddView()) } }
@nevemra5
@nevemra5 Жыл бұрын
​@@TarunReddy_RM You really saved me! Thank you so much!
@Alla-e9f
@Alla-e9f Жыл бұрын
Thanks a lot! But in my Xcode 14.3.1 colorLiteral does not work at all, also the set of icons for pen or pencil has no search and very poor looking. Any ideas what can de done?
@maguirer
@maguirer 3 жыл бұрын
FYI, I don't know if it's your capture software or KZbin's compression, but at around 17:37 when you pick Mercury for the TextField background colour, I see no actual change in the preview-it still looks plain white to me. So when you start adding padding at 18:18, and adjust it so it "lines up", I can't see what you're talking about.
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Hey Bob! The Mercury color is the "gray" color that's on the background of the TextField. When we add the padding, it's just to add some separation between the left edge of the background and where the text starts. I hope this helps?
@maguirer
@maguirer 3 жыл бұрын
​@@SwiftfulThinking Oh, I totally understand what you were doing and why, but visually it doesn't come through on the video. Maybe it's my monitor settings...
@warrenscorner
@warrenscorner Жыл бұрын
I could not get ColorLiteral to work for me. I'm using Xcode 14.3. Did they remove it?
@JonathanLetchford
@JonathanLetchford 10 ай бұрын
Minute 10:12. When I select ExtractedView it doesn't stay highlighted and won't let me rename it to ListViewRow. Xcode version 13.3. Just wondering if there is something new given this video is 2 years old. Or, if that naming even matters
@joovawoo6301
@joovawoo6301 6 ай бұрын
love you
@yuchen3587
@yuchen3587 2 жыл бұрын
When you use .padding(14) or .cornerRadius(10), what is the unit of these numbers?
@grigordoubleg
@grigordoubleg 3 жыл бұрын
How can I change the hole backgroundcolor of ListRowView? If i try to change the background, only the backgroundcolor of the items is change and the rest of the view is light/dark.
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Hi Grigor! Great question. In a List, you can use a modifier .listRowBackground() to change the background color of a row. I covered this in the Bootcamp video: kzbin.info/www/bejne/qpyyn4t9YtiBodU
@grigordoubleg
@grigordoubleg 3 жыл бұрын
@@SwiftfulThinking Okay, thank you for the answer Nick!
@kal5211
@kal5211 Жыл бұрын
My man.
@dr.craigcurphey4829
@dr.craigcurphey4829 3 жыл бұрын
Nick in the Components section - how can I change the content of the "Sign In" button to "Continue"? I used an @State variable for the buttonContent and it displays correctly but when I change the value in the switch statement, it gives an error Type '()' cannot conform to View ... etc. Tried a few other places, no luck!
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Hi Craig! I'm not sure what button you're referring to. I don't think there's a "sign in" button in this Todo app. You should be able to update a button's title with a simple ternary operator: kzbin.info/www/bejne/rquphIKapd2sY9E
@최승기-g8f
@최승기-g8f 2 жыл бұрын
thank you!!!
@陈坚涛
@陈坚涛 Жыл бұрын
Can you make a macos version tutorial? I like it very much.
@knowledgeispower4953
@knowledgeispower4953 8 ай бұрын
Cool ..😎
@kavinda_dilshan_paramsoodi
@kavinda_dilshan_paramsoodi 2 жыл бұрын
Just started watching this MVVM Architecture video series of yours for the second time to get a better idea, and to put a note on my iPad so i could refer it later. Nick My SwiftUI Angel, I need a favor brother. I'll tell you that, once you leave a reply to this comment. Thanks.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Haha what’s up KD? The source code is on my GitHub if that’s what you’re asking 😂
@kavinda_dilshan_paramsoodi
@kavinda_dilshan_paramsoodi 2 жыл бұрын
No, I don't want the source code because I don't like copy and pasting.It's better to do it my own along with your video. Anyways, that's not the favor i need. This is a request actually. Can you do a whole series of UIKIT Bootcamp and stuff later? I mean after 4 months from now on? Because I need to learn UIKIT in order to get a job. Hope you understand what I'm talking about.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
@@kavinda_dilshan_paramsoodi Haha, sorry to say this, but I won't be covering UIKit on this channel. UIKit is still popular in production right now, but SwiftUI rapidly taking over. SwiftUI is the future of iOS and that's where I think new developers should focus most of their time 🚀
@kavinda_dilshan_paramsoodi
@kavinda_dilshan_paramsoodi 2 жыл бұрын
@@SwiftfulThinking Okay Brother. I will learn SwiftUI from your courses because they're perfect.❤️👌
@kenturnbull9679
@kenturnbull9679 3 жыл бұрын
On Addview, I am not seeing the text "Type something here..." (your line 17). Everything else works . Is there a way to change the foreground color or the fontWeight so it stands out more?
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
The Placeholder text is not very customizable at this time (maybe Apple will update it in the future) so right now, the best bet is changing the background color. If you full want to customize it, you could convert a UITextField from UIKit into SwiftUI, which is fully customzeable.
@kenturnbull9679
@kenturnbull9679 3 жыл бұрын
@@SwiftfulThinking Turns out that I had added a blank space bewteen the quotes... @State var textFieldText: String = "". It looks like this stopped the textFieldText from accepting the new value. Take out the space; problem solved.
@burakcakir06
@burakcakir06 2 жыл бұрын
thanks so much.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thanks Burak!
@bulgakov1991
@bulgakov1991 Жыл бұрын
👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍
@jayantkumar1954
@jayantkumar1954 2 жыл бұрын
😍
@israelhernandez8910
@israelhernandez8910 2 жыл бұрын
when implementing the addView I received an error within @main :/ when trying to execute the simulation
@brandonr.8784
@brandonr.8784 2 жыл бұрын
I was also facing this issue. I tried a couple of thing such as using a toolbar instead of navigationbBarItems and completely quitting xcode before I got it to work.
@TarunReddy_RM
@TarunReddy_RM 2 жыл бұрын
They took out Color Literal too?!
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
lol well sort of. It's supposedly a bug in Xcode 13 but they haven't officially said anything. You can actually still access it if you type -> #colorLiteral(
@TarunReddy_RM
@TarunReddy_RM 2 жыл бұрын
@@SwiftfulThinking ahh I see thank you
@profgallaugher
@profgallaugher 2 жыл бұрын
@@SwiftfulThinking Thx - your videos have been GREAT in helping me get up to speed quickly w/SwiftUI. I also don't see the Color Literal. I'm using Xcode 13.4.1. I've tried just #colorLiteral( and enclosing it in a Color like: Color(#colorLiteral(). Neither seems to be working. I've noticed I can force a color to show up in the background modifier if I enter something like: .background(.red), and can then use the Navigator pane to pull down & select "Custom" under "Background" (replacing Red), but this doesn't bring up the standard iOS color picker box with the color pencils. Is there a work around? Thanks! For now I've just used: .background(Color(uiColor: .systemGray6))
@WilfClegg
@WilfClegg Жыл бұрын
@@profgallaugher Thanks for this. I hate it when Apple takes out these simple conveniences...and for what reason?!
@bbulliard
@bbulliard 2 жыл бұрын
.navigationTitle doesn’t show title. Any clues as to why? I’m Running latest Xcode
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Is your Preview inside a NavigationView? You need to be in a NavigationView to use the Navigation bar
@bbulliard
@bbulliard 2 жыл бұрын
@@SwiftfulThinking that is precisely the problem. I was using your sample video above and it didn't have the navigation view, which is why the title wasn't showing. I can't figure out how you got the title to work when it doesn't have a navigation view. I did add the navigation view and it works beautifully now. thank you for your very prompt response to my question.. your the best!!
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
@@bbulliard You should be able to add a NavigationView to the Preview section of the file to mimic the actual app environment
@thematturlookingfor
@thematturlookingfor Жыл бұрын
Hey man you don't have a git repository for this do you?
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
@SwiftfulThinking 🤙
@thematturlookingfor
@thematturlookingfor Жыл бұрын
@@SwiftfulThinking I might need to change the wording. Do you have a git repository for this?
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
@@thematturlookingfor lol yea on GitHub @SwiftfulThinking github.com/SwiftfulThinking/SwiftUI-Todo-List-MVVM-UserDefaults
@namormia5233
@namormia5233 2 жыл бұрын
By default I didn’t get the "back" button ☹️. But in your case it's happening.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
I think they may have made some updates in iOS 15. You should at least have some sort of back button showing though, otherwise you may not be in a NavigationView or your NavBar is hidden?
@namormia5233
@namormia5233 2 жыл бұрын
@@SwiftfulThinking There’s surely a button by which I can go back to the previous view. But the button's name didn't appear as "Back", instead it is showing "TodoList" .
@billsouthwick8123
@billsouthwick8123 2 жыл бұрын
@@namormia5233 I think it's because your "navigationTitle("TodoList") is in the view and not in the main project. Check your code and don't have the NavigationView in the view itself. I'm running Xcode 13 and iOS 15 in the simulator.
@xgqfrms
@xgqfrms 2 жыл бұрын
Color Literal not working
@richardcoterie8091
@richardcoterie8091 Жыл бұрын
Finish
@earthvitalutube
@earthvitalutube Жыл бұрын
Oof.. I can't get preview to work with the project. The failed to build scheme error. I've tried keeping the project out of iCloud folders, I've tried lowering the required iOS version, and I tried rebuilding the project again. The error happens as soon after creating the ListView.swift file
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
What does the error say?
@earthvitalutube
@earthvitalutube Жыл бұрын
@@SwiftfulThinking Thanks for your attention. The main error is "Argument passed to call that takes no arguments" which highlights "ListRowView(title: item)" from the ListView.swift file. I'm unable to replicate the scheme error again at this second but have usually seen it every time I try to preview or build.
@earthvitalutube
@earthvitalutube Жыл бұрын
@@SwiftfulThinking Ok here's all the errors: argument passed to call that takes no arguments ---------------------------------------- SchemeBuildError: Failed to build the scheme "TodoList" argument passed to call that takes no arguments Compile ListView.swift (arm64): /Users/max_miles/local xcode projects/TodoList/TodoList/Views/ListView.swift:21:36: error: argument passed to call that takes no arguments ListRowView(title: item) ~~~~~~~~^~~~~
@earthvitalutube
@earthvitalutube Жыл бұрын
@@SwiftfulThinking I'm going to try to temporarily remove the following and List it differently to see if this error goes away it fixes the scheme issue and be able to preview: ForEach(items, id: \.self) { item in ListRowView(title: item)
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
@@earthvitalutube looks like there’s a problem with the init of your ListView on line ~21
Create a custom data model for Todo items in SwiftUI | Todo List #2
11:46
Swiftful Thinking
Рет қаралды 36 М.
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
Un coup venu de l’espace 😂😂😂
00:19
Nicocapone
Рет қаралды 11 МЛН
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 42 МЛН
How I Turned a Lolipop Into A New One 🤯🍭
00:19
Wian
Рет қаралды 11 МЛН
MY HEIGHT vs MrBEAST CREW 🙈📏
00:22
Celine Dept
Рет қаралды 55 МЛН
Add a ViewModel with @EnvironmentObject in SwiftUI | Todo List #3
40:53
Swiftful Thinking
Рет қаралды 51 М.
you need to build a RUST desktop app!!
27:21
Travis Media
Рет қаралды 320 М.
КАК УСТРОЕН TCP/IP?
31:32
Alek OS
Рет қаралды 179 М.
ToDo List for beginners || Simple demo app || Swift iOS || 2023
32:05
Top 5 ChatGPT Use Cases for Professionals!
10:48
Jeff Su
Рет қаралды 62 М.
This NEW SwiftUI Feature Is AMAZING | Navigation Stacks
20:05
Beginner's Guide to the Bash Terminal
1:14:37
Joe Collins (EzeeLinux)
Рет қаралды 2,3 МЛН
SwiftUI List with Custom Cell & Passing Data
36:27
Sean Allen
Рет қаралды 117 М.
"The Life & Death of htmx" by Alexander Petros at Big Sky Dev Con 2024
23:01
Montana Programmers
Рет қаралды 64 М.
Un coup venu de l’espace 😂😂😂
00:19
Nicocapone
Рет қаралды 11 МЛН