State Properties in SwiftUI - Lesson 4

  Рет қаралды 18,226

CodeWithChris

CodeWithChris

Күн бұрын

Пікірлер: 88
@oguzyuksel9667
@oguzyuksel9667 4 жыл бұрын
Hey, you are so warm person and your way to explaning and while doing this using your mimics. I feel like I listen my teacher in elementary scool :) Thank you for these tutorials.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Awww, thanks for your kind words, Oguz! We believe in you so much! Glad that we are able to positively impact your learning experience. Keep on going and having fun learning. :-) -Arthur
@tobiasstil1495
@tobiasstil1495 5 жыл бұрын
The only thing I don't understand is, that your free awesome demonstration of coding has such a small audience 🤔 Keep up the great work, it really helps me!
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thanks for the support! Kat
@Ipadstands
@Ipadstands 2 жыл бұрын
Thanks for the video, Years ago I thought to do all UI in code with Objective-C. Then as number of views increased I gave in to Storyboards. Now I have come full circle. I'll admit your videos make SwiftUI very appealing. I have watched your first 4 old videos here and look forward to watching more. I only started to look at new solutions as I wanted to add WatchKit to my app and they were pushing swiftUI heavily. Thanks a ton, Art
@CodeWithChris
@CodeWithChris 2 жыл бұрын
Thank you so much for the kind words! - Pat
@thomaslenz2202
@thomaslenz2202 5 жыл бұрын
Great Tutorial Series! Keep going. I am new to SwiftUI and Swift iOS development at all, but I am able to build simple apps by now already. Thank you Chris!
@CodeWithChris
@CodeWithChris 5 жыл бұрын
That's awesome! Thanks for learning with us! Kat
@MeteorPhotography
@MeteorPhotography 4 жыл бұрын
Didn't realize SwiftUI was totally different from the storyboard mode. It definitely looks easier to manipulate after you get the hang of it! Thanks for these videos!
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Welcome! - Kat
@ismaakova
@ismaakova 4 жыл бұрын
I started do my coursework and I chose the topic "App Development", but actually I've never done the apps ahahaha The only things that help me is your tutorials, I absolutely fall in love with it! Thank you so much!!!!
@CodeWithChris
@CodeWithChris 4 жыл бұрын
That's awesome! You can do it! - Kat
@Stan10785
@Stan10785 5 жыл бұрын
Chris Great tutorial series. I love SwiftUI and never learned the other.
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thanks! What apps do you want to create in SwiftUI? Kat
@shahriarrahmanshaon6421
@shahriarrahmanshaon6421 4 жыл бұрын
day by day i'm becoming ur fan cris !!
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Thank you! 🙌 - Kat
@alephme
@alephme 4 жыл бұрын
Thanks a lot Chris, You are the real MVP in this game. for years I tried to start (on and off) programming in X-Code/Swift but I guess now I Do love swiftUI rather than other swift versions. It made all of stuff easier and enjoyable.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Thank you! Glad you enjoyed learning SwiftUI. 🙌 - Kat
@davidv496
@davidv496 4 жыл бұрын
Your videos are very clear and easy to understand! Thanks!
@CodeWithChris
@CodeWithChris 4 жыл бұрын
You are welcome! -Kat
@santoshlohar152
@santoshlohar152 Жыл бұрын
Very useful tutorial, it helps me lot. You are doing very great work. Thank you.
@alii.haltameemi3967
@alii.haltameemi3967 5 жыл бұрын
Thanks, very much for your efforts, and I think SwiftUI fantastic, also your presentation is very good
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thanks for the feedback! We really appreciate it. Kat
@bengleeman7105
@bengleeman7105 5 жыл бұрын
Hey, I love the content you make. I just watched your complete series on how to make your first app and was wondering if you have any tutorials that go over what the code would look like if you wanted to click a button to go to another screen. I know it sounds simple but I really want to become a good coder and I think you can really help.
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Hello, you can check this tutorial, kzbin.info/www/bejne/Z3mxaKipgreCqpo It''s a bit advanced but you can skim through it and see how to add different screens and how to navigate through them. - Francis
@ich_16
@ich_16 5 жыл бұрын
really thanks for the challenges ❤️ i am happy that i did finished all of them but with game of thrones Style🌚
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Great job on finishing the challenges!! -Kat
@begmyratmammedov9357
@begmyratmammedov9357 4 жыл бұрын
Sir, these videos are great. Thanks for that)) Also, awesome dictation. I think, swiftUI is similar to flutterUI, everything is easy and beautiful. Good option to make a awesome UIs
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Yes, they say they have similarities. Thanks for watching! - Kat
@glennadams7047
@glennadams7047 5 жыл бұрын
Very good presentation content and style. Looking forward to SF symbols lesson.
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thanks for the feedback! Kat
@devhopes
@devhopes 4 жыл бұрын
I really enjoyed this video :) Thanks! :)
@CodeWithChris
@CodeWithChris 4 жыл бұрын
I'm so glad! 🙌 - Kat
@TheOnlyHelix
@TheOnlyHelix 4 жыл бұрын
Hi Chris! Quick Question: Can you explain why numHearts has to be in a @State rather than a plain variable? Thanks!
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, it is a state so it can can "reinitialize" the view or other parts of the app that uses it to update the appearance of what is on the screen, think of it as an "active" variable that fires an event it ever the value changes - Francis
@RayFleener
@RayFleener 4 жыл бұрын
Somewhat noobie coder - All my code appears to match up (up to 7:06 in the video), but for some reason my toggle doesn't seem to be toggling. I resumed the preview, but when I try to toggle it isn't changing from the filled to empty heart or vice versa. Any thoughts as to why? I've messed with it for a while now and even tried toggling with a switch on a different project and the toggle isn't working in that project either. - Thanks
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, are you sure that you @State is declared outside the functions? so that its "global", maybe its just in the wrong place - Francis
@amolnikam1840
@amolnikam1840 4 жыл бұрын
Thats very usefull, Please take one session on Combine framework. Thanks you
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Thank you! Can you send us your requests here please? cwc.to/request - Kat
@jamilamini442
@jamilamini442 5 жыл бұрын
Swiftui is very easy and straight forward
@CodeWithChris
@CodeWithChris 5 жыл бұрын
That's true. 👍 Thanks for watching. -Kat
@astronomers
@astronomers 4 жыл бұрын
Hi there, is scrolling a state? Do I need to create 3 states? This is my use case... Almost like a carousel, my image goes from small to large once in the center of the screen. but then another state is needed for when user clicks on a larger image. State 1 - Image is small (before scroll) State 2 - Image gets slightly bigger once in center of the phone. (after scroll) State 3 - After user taps on the image, it fills the screen as background
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, this should be possible by doing a uipageview and adding some scaling to it. but i suggest looking into cocoapods maybe theres a pre-built carousel that you can use check out our cocoapods tutorial codewithchris.com/cocoapods/ - Francis
@newbiegeek8407
@newbiegeek8407 4 жыл бұрын
Chris, i recreated the challenge and it came out to be awesome but in the simulator the screen was plain white, is there a way to fix this?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, sometimes the simulator screen may stay white because your Xcode does not have enough permissions to run, try should also be a button to "refresh" the simulator screen - Francis
@rodriarano
@rodriarano 4 жыл бұрын
Hi Chris, thank you for the amazing free content! I was wondering, is there a way one can declare an element, and then reference to it to modify it. Like the challenge you propose to make the caption style change depending on IsHearted, could I have the Text element defined and then in an if-else modify its attributes? I've tried and even if I have my Text in a @State var, when I call it to modify it it just shows up in the View in double. Is there a "solution" to these mini-challenges somewhere? So as not to bother you with basic questions like this one! Thank you in advance !
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, there might be something wrong in your code a bit because it should not double, maybe the other code runs regarless if its right or wrong so you should check that, easy way is to put a print statement and see how it behaves when you change a state - Francis
@maryannadelman4438
@maryannadelman4438 Жыл бұрын
Can you show the answer to changing the state of the text when heart button is tapped? 🙂
@mamtasasotri7045
@mamtasasotri7045 3 жыл бұрын
The challenges you gave at the end of this video and the previous video, where can I find the solution of them to cross check, am not able to trace the challenges folder, please help!
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Hello, allow our technical support staff to help. Post your concern here: codecrew.codewithchris.com -Arthur
@glenreidy
@glenreidy 4 жыл бұрын
I completed the challenge, but the image changes size because of the equal spacing. How do I keep the image the same size?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, try looking into the "content compression resistance priority" of the image and make it a higher number - Francis
@sidharthadevbakshy2920
@sidharthadevbakshy2920 4 жыл бұрын
hey, just wondering why you used the self. function for manipulating the number of likes but not for filling the heart?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, this was because it was an function/closure inside the "button", and not part of the main body which is why we needed to use the .self to let it know that we are getting the value from the current file and not from inside the "closure" of the button - Francis
@90jasur
@90jasur 3 жыл бұрын
So far I am doing as you teach but I add different sembols and effects.... Thank you
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Thanks, Jasur! You got this! :-) -Arthur
@smartygirlonthecape
@smartygirlonthecape 4 жыл бұрын
Hi Chris! Your videos are amazing and they're really helping me get a start in app development. I was working on the challenge you gave us, and ran into a strange problem. When I put state variables into the parameter lists for all the modifiers for the Text elements, an error pops up for the rendering mode modifying the heart (.original), stating: 'Image.TemplateRenderingMode' is not convertible to 'Image.TemplateRenderingMode?'. Not really understanding that, I just turned .original into a variable and input that for the parameter instead, and the error magically went away. But, in its place appeared "Generic parameter 'Label' could not be inferred", and I have no idea what that means, how to fix it, or why it popped up. Neither error appeared before I started putting variables into the parameter lists for the Text element modifiers. I have tried restarting the program, but the issue persists. Do you have any insight?
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, maybe try re-doing the app again instead? it could have had an error while compiling. or you can try clearning the build files first - Francis
@chatsnoirblamo
@chatsnoirblamo 4 жыл бұрын
Subscribed! 💕
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Yay! Thank you! - Kat
@williamstorey5024
@williamstorey5024 4 жыл бұрын
I love the declarative style. Hate the implementation. I would like to see properties like in css etc vs the chaining method.
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, who knows maybe in a bit of time there will be APIs or frameworks that will let customize the use of external gui like CSS - Francis
@donathmm3881
@donathmm3881 5 жыл бұрын
SwiftUI is awesome
@CodeWithChris
@CodeWithChris 5 жыл бұрын
I agree! 🙌🙌 Kat
@gjermundification
@gjermundification 5 жыл бұрын
I have not yet played with SwiftUI, this question may be off, however I would have put ``` Image( systemName: isHearted ? "heart.fill" : "heart" ) ```
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thanks for mentioning that! We appreciate it. Kat
@augustogalindo8687
@augustogalindo8687 4 жыл бұрын
I was thinking the exact same thing
@maryannadelman4438
@maryannadelman4438 Жыл бұрын
Never mind - I got it!!
@ramagarimidi
@ramagarimidi 5 жыл бұрын
Hey Chris! I actually have a question. So for my project, I need a back button. I tried using the navigation controller button but I just can't move it. So now I decided to make my own back button but I don't know the code to do it. So can you provide me the code and where to type it and connect my button. GameViewController.swift. or GameScene.swift.
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Hello! Could you share your question in our community group here (bit.ly/CodeCrewCommunity)? Just check the posting guidelines (bit.ly/CWCHowToAskForHelp) so we can help you the best as we can! Thanks! Kat
@ramagarimidi
@ramagarimidi 5 жыл бұрын
@@CodeWithChris Ok
@Lad11971
@Lad11971 4 жыл бұрын
I don’t get that button option when I add a button the code looks completely different
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Hello, it may be because there was changes in the code since it launched.. to be fair this series was made during the initial release of SwiftUI so there have been some changes since then - Francis
@heshanyodagama8886
@heshanyodagama8886 5 жыл бұрын
please do a tutorial about Apple's Combine framework. We are waiting.
@CodeWithChris
@CodeWithChris 5 жыл бұрын
Thanks for the suggestion! We'll add it to the list of topics we'll cover. :) Kat
@heshanyodagama8886
@heshanyodagama8886 5 жыл бұрын
@@CodeWithChris Witing..
@jonathanmorris1480
@jonathanmorris1480 4 жыл бұрын
Swift UI is too nice bro, like I think its super cool and easy... but then again, I haven't been using Storyboards that long so IDK
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Yes, I agree, it's super cool and easy. Thanks for watching this. :) -Kat
@90jasur
@90jasur 3 жыл бұрын
The challenging part I stuck somewhere. Can you check it please?
@CodeWithChris
@CodeWithChris 3 жыл бұрын
I think you already solved it! :-)
@jizhou749
@jizhou749 2 жыл бұрын
I like SuiftUI, but I like Chris more.😄😄
@CodeWithChris
@CodeWithChris 2 жыл бұрын
Oh wow thank you 😅 - Pat
@hargunrana
@hargunrana 3 жыл бұрын
why did u use..... self.numhearts += 1 instead of jus numhearts +=1..... it shown an error i saw that but why?
@CodeWithChris
@CodeWithChris 3 жыл бұрын
"Hello, this was because it was inside an overload like an inner function or a closure, this will make it outside of the current scope in which we can use ""self"" in order to pertain that we intend to use the current file/class to get the variable and not inside the closure/function - Francis"
@christinewang6484
@christinewang6484 4 жыл бұрын
awesome I love this
@CodeWithChris
@CodeWithChris 4 жыл бұрын
Cheers, Christine!
@90jasur
@90jasur 3 жыл бұрын
I got it !
@CodeWithChris
@CodeWithChris 3 жыл бұрын
Yay!
SFSymbols - Why use them?
10:52
CodeWithChris
Рет қаралды 20 М.
Basic SwiftUI Layout Containers and UI Elements
14:30
CodeWithChris
Рет қаралды 38 М.
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
SwiftUI Data Flow and View Composition Tutorial
11:58
CodeWithChris
Рет қаралды 19 М.
What is JSON - JSON Parsing in Swift
24:15
CodeWithChris
Рет қаралды 75 М.
8 Common SwiftUI Mistakes - and how to fix them!
28:05
Paul Hudson
Рет қаралды 50 М.
How to use @Binding property wrapper in SwiftUI | Bootcamp #22
12:40
Swiftful Thinking
Рет қаралды 38 М.
How To Work With Any API (API Tutorial using URL Requests)
27:07
CodeWithChris
Рет қаралды 126 М.