How to use @ViewBuilder in SwiftUI | Advanced Learning #9

  Рет қаралды 25,665

Swiftful Thinking

Swiftful Thinking

Күн бұрын

In the last video, we learned how to use generics. Now, we will use @ViewBuilder to create closures where we can pass in generic types to our views. This is especially handy in SwiftUI when we want to build sub-views within parent closures (or containers).
🤙 WELCOME BACK 🤙
WEBSITE: www.swiftful-thinking.com
DISCORD: / discord
GITHUB: github.com/SwiftfulThinking/
SAY THANKS: www.buymeacoffee.com/nicksarno

Пікірлер: 75
@ismailMerced
@ismailMerced Жыл бұрын
I love how Nick give us the problem and then introduce us to the solution
@nagornik
@nagornik 2 жыл бұрын
I'm learning Swift and I have a few resources where I get information from. You're definitely the best! Sometimes instead of googling I just watch your video about some technology or something and it's much more informative because of the way you explain stuff with examples. When I become a fancy developer I owe you a beer, man. You're awesome! Thank you for what you do.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thanks man! Good luck on your coding journey 🚀🚀
@CookJapanChannel
@CookJapanChannel 2 жыл бұрын
When you like Nick's video before even watching it.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Haha I love that 🥰 Thanks for watching!!
@Dorothyinstead
@Dorothyinstead 2 жыл бұрын
Hahaha, have only just begun to watch Nicks basic tutorials on SwiftUI. But am sure, in time, I will be going through these more advanced videos. I like his style and clarity.
@glorytoukraine6956
@glorytoukraine6956 2 жыл бұрын
Awesome explanation! Thank you!
@PLawesomeness
@PLawesomeness Жыл бұрын
This playlist is so good. Thank you!
@aaronr2248
@aaronr2248 2 жыл бұрын
Another phenomenal video, Nick. Thank you for taking the time to put together such helpful and well demonstrated videos. Top quality stuff.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thanks for watching! Glad you're enjoying the content.
@RK-wg7wr
@RK-wg7wr 2 жыл бұрын
Just finished watching all your playlists. Thank you for the great contents!!
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
All of them? Haha awesome! Thanks for watching :)
@tambui3603
@tambui3603 6 ай бұрын
From Vietnam, Thanks a lot for your amazing contents. Can't wait for your next swift ui courses
@toastrecon
@toastrecon Жыл бұрын
Thanks! Lots of great info!
@selvarajant
@selvarajant Жыл бұрын
Simple and clear explanations. Thanks
@user-wm9lq4fd8i
@user-wm9lq4fd8i 2 жыл бұрын
amazing tutorial! appreciate!
@Pepe_the_raver
@Pepe_the_raver 9 ай бұрын
Following this course means jumping to a whole new level of coding with SwiftUI, I simply love it!
@SwiftfulThinking
@SwiftfulThinking 9 ай бұрын
Let’s goooo 🚀
@sols.2525
@sols.2525 2 жыл бұрын
Awesome video and series Nick. This is some powerful stuff. I don't even know how you learned all this stuff but I have taken paid courses in the past and you have hands down the best stuff I have seen.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thank you Scott! I have taken many of those courses as well and it's actually a big part of the reason I started this channel. I felt that most of the SwiftUI courses weren't really teaching the topics, but rather just making an app and having students copy the code. Anyway, glad you're enjoying the channel. 🥳
@mhfs61
@mhfs61 2 жыл бұрын
Thank you, Nick. Very helpful 👍🏼👍🏼👍🏼
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thanks for watching Marlon!!
@magedmohmed4403
@magedmohmed4403 9 ай бұрын
Thanks a lot nick , you are perfect in explanation
@rudra003
@rudra003 Жыл бұрын
very well detailed explanation Nick, thank you 👍
@nyangkkun2
@nyangkkun2 Жыл бұрын
와 정말 소리질렀어, 넌 최고야. It was a really difficult concept to understand, but now I got it. Thank you so much
@andresraigoza2082
@andresraigoza2082 2 жыл бұрын
So cool, Thank you so much!!!
@Simon-zy9mb
@Simon-zy9mb 2 жыл бұрын
I like it Nick. This is a great course!
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thanks Simon!
@Notkdenben
@Notkdenben Ай бұрын
Im in awe of how this lines up. I’ve been struggling to understand swiftUI sort of “under the hood”. I can understand why this is in advanced learning, but I really wish I could’ve had this puzzle piece around the same time I was being introduced to swiftUI view components. This is a really interesting concept.
@EnisTola
@EnisTola Жыл бұрын
thank you so much. such a helpful tutorial, learned a lot 🙏
@Stricken174
@Stricken174 Жыл бұрын
Wonderful explanation!
@josemanuelortizsanchez4983
@josemanuelortizsanchez4983 Жыл бұрын
I wish I had known earlier about using @ViewBuilder in conjunction with computed variables of type some: View. Thanks, this is going to improve the code of my applications a lot.
@edwardjob1437
@edwardjob1437 2 жыл бұрын
Really great great great SwiftUI tutorial videos I ever watched. The author is absolutely a great developer and teacher.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thanks Edward!
@LebenWerden
@LebenWerden Ай бұрын
Well done explained.
@tutecodes3631
@tutecodes3631 Жыл бұрын
Really helpful content Thank you so much
@deterligegyldigt
@deterligegyldigt 2 жыл бұрын
If I don't add the @ViewBuilder in the init it still seems to work. The important part to note about viewBuilder is that it allows for multiple subviews. If you remove the VStack in "Generic 3" sample, it proves the point better: without the @ViewBuilder, the compiler complains, with it, it behaves like a VStack
@denisk3852
@denisk3852 2 жыл бұрын
Great 👍
@lukassbeataddicts
@lukassbeataddicts 2 жыл бұрын
How awesome. Thanks
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
😄
@dart-lin3571
@dart-lin3571 2 жыл бұрын
Thank you very much.
@katesychenko
@katesychenko 2 жыл бұрын
Thank you!
@alexl2512
@alexl2512 6 ай бұрын
Exactly what I want to learn about @ViewBuilder.
@bhuwin6186
@bhuwin6186 Жыл бұрын
Amazing
@Lammax2012
@Lammax2012 Жыл бұрын
Thanks!
@JZ-xc8hu
@JZ-xc8hu Жыл бұрын
this video is very useful and understand for beginer
@paulancajima
@paulancajima 2 жыл бұрын
Thank you
@erdemsenol9642
@erdemsenol9642 2 жыл бұрын
Nick you are a really great developer and teacher. Your content is amazing, thank you. But we really grasp what we learn better by building whole apps, like we have done in the coin app you built. I will suggest you 2 topics and I would be grateful if you consider them. 1) I have difficulties about finding a complete tutorial for swiftui-mapkit integration(not only showing user location, but also showing area of interests, making custom annotations and marking the map so that other users can see, search and pin locations etc.). And secondly, building apps based on an api using async functions and asyncImage feature has some unclear areas for most of the developers. Can you focus one of the issues on your next tutorial series please?
@erdemsenol9642
@erdemsenol9642 2 жыл бұрын
And please post new courses in UDEMY, I will definitely buy whatever you put out there.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Hello! Thanks for watching :) After I finish this bootcamp playlist, I will be adding another course where we build a whole app. I try to always do bootcamp videos before the course so that the code in the course makes more sense and people can refer back to the bootcamp vids if they get stuck! I will definitely add to my list a few videos for integrating MapKit, great suggestion. However, I won't be using async functions in my next app though because async is only available for iOS 15 and is not backwards compatible. Most production apps will be supporting iOS 14 for at least another year or two, so it's not very realistic to use yet. I'll do some bootcamp videos on it soon.
@erdemsenol9642
@erdemsenol9642 2 жыл бұрын
@@SwiftfulThinking you are amazing. Thank you!
@sondoskannous3306
@sondoskannous3306 Жыл бұрын
thank you
@cozybazaar
@cozybazaar Жыл бұрын
thank you for the amazing content Nick! I have one question: isn't [ some View ] an opaque type? so the compiler should know the concrete type at compile time (static dispatch) and switching types adds dynamism so how does the [ @ViewBuilder ] solve this problem? Thanks a lot 💛
@wavyemoji6375
@wavyemoji6375 2 жыл бұрын
love you brooo
@wavyemoji6375
@wavyemoji6375 2 жыл бұрын
lol im felt in love with coding again appreciate you man
@danielcrompton7818
@danielcrompton7818 27 күн бұрын
Hi Nick thanks so much as usual fir great free content! Definitely worth the like and subscribe!! I have a question though, why do you need the @Viewbuilder and why can’t you just have the closure to return contrnt?
@sureshkumar-yy5lf
@sureshkumar-yy5lf Жыл бұрын
It's really informative and explanation is very good with examples. Only thing i have suggestion is to keep the example code, so that it will be really helpful.
@franklemur5518
@franklemur5518 Жыл бұрын
I realize I am coming to this a year after posting but it is still VERY relevant and USEFUL. The music is a little unusual but if that what you like then who am I to comment. Seriously, this is good stuff are you going to release /update for ios16 new features/changes?
@korges2590
@korges2590 2 жыл бұрын
I really like your content. For me you are the best source of Swift learing materials. I've big request for you. Could you please create some tutorial how to organize package structure in big iOS apps? Multiple screens, widgets, database and so one. Thanks :)
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Hi Korges! Thanks for the comment. That's a really broad question because every app is different and the files should be organized for the specific app's needs. I will be doing a more advanced app course soon though, which will have a realistic architecture.
@SE-jk2gt
@SE-jk2gt 5 ай бұрын
Cool
@AdjieSatryo
@AdjieSatryo Жыл бұрын
Hi, i found that in order to create optional initialization we can use init(type: ViewType, @ViewBuilder content: () -> Content) { self.type = type self.content = content() } init(type: ViewType) where Content == EmptyView { self.type = type self.content = EmptyView() } Do you think its the right way? thank you
@SwiftDeveloperWorld
@SwiftDeveloperWorld Жыл бұрын
what resources do you usually study to become advance in IOS development
@TCakes
@TCakes Жыл бұрын
I use @viewbuilder all the time, thanks to the youtuber Kavsoft. I think it makes the code very clean and easy to navigate, especially with child views you do not plan to reuse.
@cinquain0
@cinquain0 2 жыл бұрын
Good stuff Nick. When is push notifications coming
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Haha they're coming in CloudKit section at the end of this playlist 🤓 We need a server for real push notifications, so CloudKit will be the easiest way.
@ModelMaster1
@ModelMaster1 Жыл бұрын
Love your videos. So informativ! Although a couple of things do not seem to work (ViewModifier, CostumButtonStyle and most prominently the @ViewBuilder wrapper), even though I have a newer version of Xcode installed on my computer. When asking Chatgpt, it says, that my version of swift is too old, which would explain a lot. When checking in the build setting it says I am using swift 5 (as well as giving me the option to downgrade to 4 and 4.2). So my question is, is chatgpt right? And if yes, how do I fix it and why doesn’t Xcode do it automatically? Thank you for your Help.
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
These all definitely work, I use them all the time. Maybe you’re typing something wrong? The project is on my GitHub @SwiftfulThinking if u want to compare code
@snowy9798
@snowy9798 Жыл бұрын
@@SwiftfulThinking Yes. I think it's some sort of setting, because to check if i was typing it wrong, I copied and pasted a view modifier code from the web and still had the same erros. Anyways, I'll figure it out later for now I am learning cloudkit. Really great video by the way. Keep up the great work! 😁
@mahmoudzinji5672
@mahmoudzinji5672 Жыл бұрын
Can the content be nil or optional ?
@DaikiKaneda
@DaikiKaneda Жыл бұрын
you are god
@itsAJ819
@itsAJ819 2 жыл бұрын
I absolutely love your content. I enrolled in your udemy course. Would you ever consider possibly creating a slack or a discord for support? I know I could definitely use the help on one topic for sure. The Q&A from Udemy is not the greatest in regards to notifications.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thanks AJ! Yea, you're right haha. I will be starting a Discord channel next week! I'll post about it in the "Community" section of my channel once it's up.
@itsAJ819
@itsAJ819 2 жыл бұрын
@@SwiftfulThinking absolutely amazing. I love your Udemy course. It’s helped me grasp a lot that other courses couldn’t do. Truly appreciate you my friend.
@jameskayten6563
@jameskayten6563 10 ай бұрын
All these updates are worthwhile, but they're not as watchable because the navigator column is not closed and the screen space is wasted making viewing a squinting exercise. It's understandable, one cannot anticipate what changes made by Apple will make the older lessons a nuisance to follow, but at least make them readable. This safe area inset vid was frustrating as while in Xcode 15, much of the auto completion doesn't match up with the vid. I don't suppose I'll miss much in the safe area inset in any case, but the Navigation Stack lesson was difficult. And the thing is; if any file in the app collection is failing, one cannot proceed with another lesson. I've to go back and find the things that are broken before I can proceed which ofter means commenting out most of the contents unless I want to revisit the lesson. Not a complete waste of time, but still a bit of an obstacle. For instance; now that I'm moving on to the "Groups" lesson, I've to stop and find what's unhappy. I finally just deleted the last 'SafeAreasInset' file so I could get on with the program.
How to use Protocols in Swift | Advanced Learning #15
28:37
Swiftful Thinking
Рет қаралды 15 М.
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 42 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 18 МЛН
哈莉奎因以为小丑不爱她了#joker #cosplay #Harriet Quinn
00:22
佐助与鸣人
Рет қаралды 7 МЛН
How to use Generics in Swift | Advanced Learning #8
19:24
Swiftful Thinking
Рет қаралды 14 М.
Interview with a Senior C# Developer
10:56
Programmers are also human
Рет қаралды 620 М.
Download JSON from API in Swift with Combine | Continued Learning #23
34:43
How to use Do, Try, Catch, and Throws in Swift | Swift Concurrency #1
26:34
How to use NavigationStack in SwiftUI | Bootcamp #62
23:59
Swiftful Thinking
Рет қаралды 32 М.
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 42 МЛН