What is Object Oriented Programming for Swift | Swift Basics #8

  Рет қаралды 13,610

Swiftful Thinking

Swiftful Thinking

Күн бұрын

Unlock the power of object-oriented programming in Swift with this comprehensive tutorial! Learn the core principles of OOP, including classes, objects, and inheritance. Discover how to create reusable code using encapsulation and abstraction. Master the art of polymorphism to enhance code flexibility and modularity. Start your journey to becoming a proficient Swift developer today and harness the full potential of object-oriented programming in your projects!
This is an introductory video for beginners. For full details: • Swift: Struct vs Class...
🤙 WELCOME BACK 🤙
WEBSITE: www.swiftful-thinking.com
DISCORD: / discord
GITHUB: github.com/SwiftfulThinking/
SAY THANKS: www.buymeacoffee.com/nicksarno
00:00 Object Oriented Programming
00:00 Intro
03:16 Welcome back!
05:19 Object Oriented Programming
07:08 Init vs Deinit
08:38 Automatic Reference Counting (ARC)
13:25 Memory Types: Stack vs Heap
16:49 Multi-Threaded Environment
20:16 Value vs Reference Types
25:45 Struct vs Class
27:25 Explained to a 5-year old
33:00 When to use Struct or Class
34:28 Wrapping up
35:48 Summary
38:55 Conclusion

Пікірлер: 47
@jcclcreations7909
@jcclcreations7909 4 ай бұрын
I'm the type of learner that I need to know why I'm doing something in order for me to retain the information and put it into use for myself, otherwise I'm just copying and pasting from memory. I have been trying to find a good description that separates a class and a struct and you're the first person in a very long time to explain it so clearly and to the point. So many tutorial videos on KZfaq start with just creating an app. While I get that repetition for programming is needed, you also need to know why you're doing something because otherwise you won't understand how to implement unless told to. This entire video series has been amazing. Thanks for all the great work you put into these.
@anastasiash2516
@anastasiash2516 Жыл бұрын
This playlist would save me so much time if it existed when I started learning Swift! Great content, Nick. Thank you for the beginner-friendly explanations.
@qiyanpepenanook598
@qiyanpepenanook598 Жыл бұрын
I wish I could have learned that way at the beginning of my career. Amazing tutorials. Thank you
@mateuszszafarczyk2523
@mateuszszafarczyk2523 10 ай бұрын
Hi Nick! First I am to thank you for your videos. I have learned a lot from them! I wanted to point out that ARC in this video could be wrong explained. Automatic Reference Counting (ARC) does NOT: -Count the total number of objects in memory. Automatic Reference Counting (ARC) DOES: -Keep a count of the number of references to a particular object in memory. -Increment the count when a new reference to the object is established and decrement it when a reference is removed. -Deallocate the memory occupied by an object when the reference count drops to zero, meaning there are no more references to the object and it's no longer accessible in your program. So, ARC in Swift is about managing the number of references to specific instances, not a count of all instances in memory. This helps to avoid memory leaks and efficiently manage memory in applications. @SwiftfulThinking please give a comment on that. I got it wrong from the video or it is indeed wrong explained?
@alexliebhaber3109
@alexliebhaber3109 18 күн бұрын
Glad I found this channel. Thank you for what you do!
@alexzlatic8482
@alexzlatic8482 11 ай бұрын
This playlist is awesome, and addresses so many of the base level questions and confusions that have discouraged me from learning Swift and SwiftUI in the past. Thank you!!
@MannyWalks
@MannyWalks 3 ай бұрын
mamma mia Nick, you're something else on how you explain things 🔥🔥🔥 Thanks so much 🙏
@sele_br129
@sele_br129 Ай бұрын
What a class! This is amazing omg! Thank you so much for recording this video!
@jlambert12013
@jlambert12013 Жыл бұрын
Thank you. This is exactly what I needed.
@psps4754
@psps4754 Жыл бұрын
Awesome explanation
@acordafitnesstv
@acordafitnesstv 6 ай бұрын
Great tutorial!! Thanks for sharing !😊
@jalapisco
@jalapisco 3 ай бұрын
Excellent way to break it down. I watched the advanced video you are referring to on this video few months ago; you also did an awesome job on that one too.
@samanthawithanage7521
@samanthawithanage7521 Жыл бұрын
Awesome, this is really helpful in understanding the concepts. Thanks a lot 🎉🎊
@rallygsixtwo4836
@rallygsixtwo4836 6 ай бұрын
Haven't done any sort of programming since very basic Unity C stuff in high school. These tutorials are amazing!
@drkadambarijaderam4766
@drkadambarijaderam4766 Ай бұрын
Theory is so important and often overlooked. Well done!
@manishparihar3361
@manishparihar3361 11 ай бұрын
Well explained Stack and Heap also Class and Struct. I love the way you explained swift
@amaniduniaapps
@amaniduniaapps 4 ай бұрын
Hey Nick, I'm very amazed about how clear you explained this. Well Done! 🤓
@m.d.2029
@m.d.2029 Ай бұрын
Огромное спасибо, дружище! Это круто!
@ArthurSh
@ArthurSh 7 ай бұрын
i mean, that metaphor saved me so much time, also section where to use classses and struct made it much clearer how typically it's being used in real projects, thank u for this wise and simple work, liked & subscribed, wish you a lot of health and good days in your life.
@ubuandeyelbme
@ubuandeyelbme 5 ай бұрын
Hey Nick. First off, thanks!!!! This playlist is extremely helpful. Secondly, just wanted to give you my take on this video specifically. I've been writing "professionally" (for my job) in C# for the last 5 years plus, i.e., I've hit my 10,000 hours with C# more or less. I went to school for engineering, not computer science, so the majority of what I've learned has been self taught as well. This video has been my favorite so far. Granted, all the videos leading up to this video have been essential as well since C# doesn't transfer the easiest to Swift's declarative style, not to mention learning basically all new syntax. But this video... for me, this video is GOATed. It filled in a bunch of gaps and provided A TON of great refreshers!! Thanks, man!!
@y.v.8803
@y.v.8803 4 ай бұрын
Amazing, keep up the great work
@gabrielkime6597
@gabrielkime6597 6 ай бұрын
This is an awesome video, I love how much context you give for WHY different practices and syntaxes exist in swift. You do a great job of breaking down a complex subject, and as someone who struggles with just doing something without knowing why, its really helpful how you take the time to compare and contrast concepts and also to relate them to more fundamental CS concepts at the same time. Big thumbs up, you have a new subscriber!
@SwiftfulThinking
@SwiftfulThinking 6 ай бұрын
Glad it was helpful!
@saturos5403
@saturos5403 4 ай бұрын
Incredibly confused but it helped me out
@elaidzhashchukin7268
@elaidzhashchukin7268 10 ай бұрын
u r the best man 💪
@leon.dev89
@leon.dev89 8 ай бұрын
Very good video.
@loudibird
@loudibird 11 ай бұрын
you're way to hard on yoursel, this is all making sense to me. Thanks alot man
@jean-michelnogaro7471
@jean-michelnogaro7471 11 ай бұрын
Enfin .. la lumière pour moi struct vs class 💡
@zlatkoiliev8927
@zlatkoiliev8927 Жыл бұрын
Thank you for doing this video series. I am learning a lot! Are you also planning to update the SwiftUI course after this one? There are many new things there too!
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
Yes, I append videos to the end of every playlist as new features come out. 99% of the SwiftUI Bootcamp is still relevant and anything deprecated should be addressed in the appended videos. iOS 17 updates will be added soon 🤙
@HUNTELAAR11W
@HUNTELAAR11W Жыл бұрын
Where do you learn all these things? Thank you as always Nick! You are awesome! 🤙
@user-mw2sq3cw1s
@user-mw2sq3cw1s 9 ай бұрын
This video is awesome. You helped me understand some of the unclear things between structs and classes and more. I have one question. Why is it called object 'oriented' programming? is it because we can create and destory objects with Swift? or is there more than that? Thank you for making this video😊
@toddlask
@toddlask Жыл бұрын
youre a true badass! hey could u do a vid on @observable , @state , @environment and @binding stuff? i saw a wwdc vid on it... blew my mind up!
@warrenscorner
@warrenscorner Жыл бұрын
Wow! My ADD kicked in about half way through that. 😂 All I heard after that was blah, blah, blah. I’m gonna have to watch that again and maybe again.
@MosabbirSadman
@MosabbirSadman Жыл бұрын
Thank you as always Nick! You are awesome! 🤙 I have a question, though: If we need to handle shared references, would using a class as a data model be the right choice? Otherwise, with a struct, we'd have to manually update all copies of the struct that we reference, correct? Additionally, I wanted to inquire if you've got any plans to release any paid courses on the website in the future?
@flash698
@flash698 Жыл бұрын
If you need to keep track of multiple copies of the same data, you should use a class instead of a struct. With a struct, you would have to manually update each copy of the struct whenever you make a change. This can be a pain and easy to mess up. Also not to mention error-prone. Classes, on the other hand, being reference types means that when you create a class instance, since swift keeps track of all the copies of that instance. If you make a change to one copy of a class instance, all the other copies will also be updated. This makes it easy to keep track of shared data.
@MosabbirSadman
@MosabbirSadman Жыл бұрын
@@flash698 Thank you for the reply. But if you use a class for this scenario, doesn't this come with some performance cost?
@rvst3682
@rvst3682 11 ай бұрын
hey nick, can you please make a video that are more "advance" from OOP?😁
@SwiftfulThinking
@SwiftfulThinking 11 ай бұрын
It’s right here: kzfaq.info/get/bejne/Y7B8mNGEubGpk3U.html
@kdtechniquesofficial6153
@kdtechniquesofficial6153 11 ай бұрын
Seems like NIck has a 5-year old neighbour next door.
@simply6162
@simply6162 Жыл бұрын
is Stack basically L1,L2,L3 cache and HEAP is basicaly RAM which is slower?
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
I’m not sure to be honest… they both might be RAM but I could be wrong. Let me know if you find the answer!
@simply6162
@simply6162 Жыл бұрын
@@SwiftfulThinking yes they are all on ram, thats what i found: Yes, both the stack and the heap are stored in a computer's RAM (Random Access Memory). The stack is a region of memory used for local variables, function call frames, and other temporary data. It grows and shrinks automatically as functions are called and return. Each thread in a program has its own stack. The heap, on the other hand, is a region of memory used for dynamic memory allocation. It is where objects and data structures created with `malloc`, `calloc`, `new`, or other allocation methods are stored. Unlike the stack, the heap does not have a specific size limit and can grow as needed. Both the stack and the heap are important components of a program's memory management. The stack is typically used for managing function calls and local variables with automatic storage duration, while the heap is used for managing dynamically allocated memory that persists beyond the scope of a single function call.
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
@@simply6162 thanks for posting! I’m sure someone else will find this helpful too 👌
@Foxekins
@Foxekins 9 ай бұрын
The way I see it is that classes are more like an object that is a let vs a struct where the object can be edited like a var, I may be wrong I'm new, but I'm okay with being wrong.
@DannyBoy443
@DannyBoy443 3 ай бұрын
The value vs reference editing makes 0 sense lol. How it does work: Editing a value edits a copy. How it SHOULD work: Editing the value is editing the actual value, done and done. Why create a new copy? Same but flipped for the reference type. This is one of the issues about learning this for a career that is making me re consider. It's dumb.
@marsrocket
@marsrocket Ай бұрын
Dude….good video but you spent the first 7 minutes saying the same thing over and over
How to use Structs in Swift | Swift Basics #9
30:24
Swiftful Thinking
Рет қаралды 10 М.
How to use Generics in Swift | Advanced Learning #8
19:24
Swiftful Thinking
Рет қаралды 14 М.
터키아이스크림🇹🇷🍦Turkish ice cream #funny #shorts
00:26
Byungari 병아리언니
Рет қаралды 28 МЛН
Дибала против вратаря Легенды
00:33
Mr. Oleynik
Рет қаралды 4,4 МЛН
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 11 МЛН
МАМА И STANDOFF 2 😳 !FAKE GUN! #shorts
00:34
INNA SERG
Рет қаралды 4,2 МЛН
Ditch your Favorite Programming Paradigm
6:08
Code Persist
Рет қаралды 168 М.
How to use Arrays and Sets in Swift | Swift Basics #13
29:12
Swiftful Thinking
Рет қаралды 7 М.
How to use Functions in Swift | Swift Basics #5
36:25
Swiftful Thinking
Рет қаралды 16 М.
How to use Optionals in Swift | Swift Basics #6
53:57
Swiftful Thinking
Рет қаралды 15 М.
The Flaws of Inheritance
10:01
CodeAesthetic
Рет қаралды 905 М.
5 Tips For Object-Oriented Programming Done Well - In Python
16:08
Swift - Stack vs Heap
9:58
Swift Arcade
Рет қаралды 7 М.
Object-oriented Programming in JavaScript: Made Super Simple | Mosh
1:02:49
Programming with Mosh
Рет қаралды 1,9 МЛН
How to Filter, Sort, and Map in Swift | Swift Basics #16
16:26
Swiftful Thinking
Рет қаралды 6 М.
터키아이스크림🇹🇷🍦Turkish ice cream #funny #shorts
00:26
Byungari 병아리언니
Рет қаралды 28 МЛН