No video

Swift Structs - Value Type vs. Reference Type

  Рет қаралды 15,405

Sean Allen

Sean Allen

Күн бұрын

Check out more information on Devmountain:
bit.ly/35Tzs9K
In this video I explain structs and how they are similar and different than classes, namely value types vs. reference types. This tutorial was done using Swift 5.3 and Xcode 12 beta.
My video about class:
• Swift For Beginners - ...
If you like my teaching style, I've released my first iOS dev course which is all about the take-home project job interview for iOS developers.
Course Info - seanallen.teachable.com/
Link to my book - How I Became an iOS Developer:
gumroad.com/l/sean-allen-origin
Hired.com:
hired.com/x/1n01g
Check out my podcast, iOS Dev Discussions:
itunes.apple.com/us/podcast/i...
Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):
Ray Wenderlich Books:
store.raywenderlich.com/a/208...
Ray Wenderlich Videos:
store.raywenderlich.com/a/208...
Mark Moeykens SwiftUI Views & Animations Mastery:
www.bigmountainstudio.com/a/f...
Donny Wals - Combine Framework:
gumroad.com/a/909014131
Paul Hudson's Hacking With Swift:
gumroad.com/a/762098803
Learn Advanced Swift Here:
gumroad.com/a/656585843
Links to my iOS Dev Setup & iOS Dev Book Recommendations
www.amazon.com/shop/seanallen
Personal Links:
Twitter:
/ seanallen_dev
Instagram:
@seanallen_dev
#swift #softwaredeveloper #iosdeveloper

Пікірлер: 60
@seanallen
@seanallen 4 жыл бұрын
If you enjoy my teaching/presentation style, I started created courses at seanallen.teachable.com. You can check out the first few videos for free to get a feel for them.
@austinkchang
@austinkchang 4 жыл бұрын
The Google Sheets vs. Excel Spreadsheet is such a good analogy!
@seanallen
@seanallen 4 жыл бұрын
Thanks Austin 👍
@zaquin_1
@zaquin_1 Жыл бұрын
Wow, this is the best video explain the difference of the class and structs I found in KZfaq 👏🏻
@seanallen
@seanallen Жыл бұрын
Glad you enjoyed it!
@pratikgupta7373
@pratikgupta7373 5 ай бұрын
The Google Sheets vs. Excel Spreadsheet is such a good example
@seanallen
@seanallen 5 ай бұрын
Glad you liked the analogy :)
@ssaai
@ssaai 9 ай бұрын
what a comparison Google Sheets vs. Excel Spreadsheet 👏🏻👏🏻👏🏻👏🏻👏🏻👏🏻👏🏻
@hardipgajera2316
@hardipgajera2316 4 жыл бұрын
you teach iOS as simple as apple introduce their new iPhone simple, beautiful and powerful thank you for amazing content and when you start SwiftUI video ?? please start soon
@seanallen
@seanallen 4 жыл бұрын
Thanks for the kind words. I'm going to start my shift into SwiftUI content once iOS 14 and Xcode 12 are official in a couple months.
@hardipgajera2316
@hardipgajera2316 4 жыл бұрын
@@seanallen thankyou !
@TheBorpol
@TheBorpol 4 жыл бұрын
Reaaally clear explanation Sean! Thank you so much! Your analogy was brilliant!
@seanallen
@seanallen 4 жыл бұрын
Thanks Fernando. I've used that analogy a lot and many seem to enjoy it.
@abrahammstein2497
@abrahammstein2497 4 жыл бұрын
I love the analogy!
@elsayedahmed1162
@elsayedahmed1162 4 жыл бұрын
hello my bro at first of all i want to thank you for all your lecture it's very professional but i want from you publish video about extension keyboard and how it works , there isn't any source for it . i hope to make that . thanks 🥰
@vhoraprakashkumarmahendrab3257
@vhoraprakashkumarmahendrab3257 3 жыл бұрын
thanks a lot Sean Allen to explain all this stuck in detail
@seanallen
@seanallen 3 жыл бұрын
Glad it was helpful!
@tiagoalexbastos
@tiagoalexbastos 4 жыл бұрын
The analogy is amazing!
@seanallen
@seanallen 4 жыл бұрын
Glad you liked it, Tiago!
@obtusei
@obtusei 4 жыл бұрын
Can you make a video on how to make custom xcode project template in xcode 11
@a4advanture755
@a4advanture755 3 жыл бұрын
Sean sir i love your video and skills. i like your style to deliver the information,so much.
@eazy_profit
@eazy_profit Жыл бұрын
Great explanation
@seanallen
@seanallen Жыл бұрын
Thanks!
@leonidkuznetsov7604
@leonidkuznetsov7604 4 жыл бұрын
Nice explanation!
@seanallen
@seanallen 4 жыл бұрын
Thanks!
@yabka9688
@yabka9688 3 жыл бұрын
perfect explanation thanks
@seanallen
@seanallen 3 жыл бұрын
Glad it helped!
@atwelwe7327
@atwelwe7327 4 жыл бұрын
Ty Sean!
@seanallen
@seanallen 4 жыл бұрын
Happy to help!
@hanmoklee4055
@hanmoklee4055 4 жыл бұрын
so clear. Thanks!
@seanallen
@seanallen 4 жыл бұрын
Glad it was helpful, Hanmok!
@mahmoudarafat9483
@mahmoudarafat9483 2 жыл бұрын
so clear.
@VeryBlueBot
@VeryBlueBot 4 жыл бұрын
great vid like always! Small polish to your analogy- Classes are more as a blueprints, And by initiating a class you use this blueprint to create an instance (sean in this case). That instance is a reference so if you assign it to any other variable it will lead to the same place in memory (of the instance not the class). Honestly its probably a TMI but just wanted to point that out, partially to make sure I understand it correctly.. So basically using this comment as my rubber debug duck :)
@seanallen
@seanallen 4 жыл бұрын
You understand it correctly. The blueprint analogy is a good one. I'm going to start using that.
@VeryBlueBot
@VeryBlueBot 4 жыл бұрын
@@seanallen cool :)
@tny7390
@tny7390 3 жыл бұрын
this really is an awesome analogy
@seanallen
@seanallen 3 жыл бұрын
Glad you liked it, Antonio!
@ingongoyama3995
@ingongoyama3995 4 жыл бұрын
not to change the subject but have you checked out The Healthy Software Developer. Great stuff on the Culture. Unique subject matter and the guy is honest and an expert like you.
@seanallen
@seanallen 4 жыл бұрын
I've seen their thumbnails pop up in my recommendations, but never watched. I'll check it out.
@arghasphotos
@arghasphotos 3 жыл бұрын
best analogy
@roushilsingla6325
@roushilsingla6325 4 жыл бұрын
Thank You!!
@seanallen
@seanallen 4 жыл бұрын
You're welcome!
@ajcutler54
@ajcutler54 4 жыл бұрын
Sean, I always enjoy your videos, they are easy to understand and thorough. One major decision for me when deciding on a Struct or a Class is if I need to use ObservableObjects. If I do then it's a class as Structs don't support it.
@seanallen
@seanallen 4 жыл бұрын
Good point on this.
@venkatesh_
@venkatesh_ 4 жыл бұрын
Hey Man, Nice Video! Can you make a video about Realm, would appreciate it, Keep up the good work!
@seanallen
@seanallen 4 жыл бұрын
Glad you liked it. I've never used Realm, so it's tough for me to make a video on that one.
@denisp.7850
@denisp.7850 4 жыл бұрын
Great video as usual! Just one question: why would you need optional properties in a class when you still provide an init? Isn't that the whole point of optionals having no value at the moment of initialization?
@seanallen
@seanallen 4 жыл бұрын
If certain properties are optional, then they do not have to be included in the initializer. Making a property optional gives you flexibility in how you initialize your object (you can have more than one initializer per class)
@Sergey-ue3ro
@Sergey-ue3ro 2 жыл бұрын
Struct has a memberwise initializer, but classes doesn't have? Why?
@sanjayarun4947
@sanjayarun4947 4 жыл бұрын
The thing that confuses me is that structs can also have methods in it and can implement protocols. Coming from a C background, that is just not making any sense. Can you make a video explaining those?
@OGBhyve
@OGBhyve 4 жыл бұрын
Sanjay Arun C does not have the class keyword but has structs. In C++ there are classes and structs. The only difference between them is that struct members (variables, methods) are public by default where classes are private by default. In languages like C or C++, you have full control over whether you stack or heap allocate and whether you pass something by value or by reference. Other languages like Swift or C# make some things reference types and others value types and handle for you how that gets stored in memory. TL;DR If you're not familiar with references in C using &variable_name, that may help clear things up.
@julianbdeveloper
@julianbdeveloper 4 жыл бұрын
Hey Sean, great video. On an unrelated note, I have a question about React Native. I know you already made a video about it, and you’re an Apple fan boy like myself - but do you think it’ll ever replace Swift development? And with that, do ever plan on learning it? I feel like once you know how to program you can take that skill to any language or framework. Thanks Sean, Julian
@seanallen
@seanallen 4 жыл бұрын
I agree, that once you learn how to program you can pick up a new platform or language relatively quickly (or at least much faster than you learned your first language/platform). I do not believe it will ever replace Swift development and I have no intention on learning it. But that's just my opinion.
@julianbdeveloper
@julianbdeveloper 4 жыл бұрын
@@seanallen Gotcha, thanks for the reply. I've been watching you for a while now and I am really enjoying the content.
@ondrix147
@ondrix147 3 жыл бұрын
what about guard
@ajjones929
@ajjones929 4 жыл бұрын
Someone told me that I had no ‘class.’ I told them, ‘Good. I work better with Structs, anyway.’
@seanallen
@seanallen 4 жыл бұрын
Ba dum bum. They're here all week folks. Be sure to tip your waitress. 😀
@muha990
@muha990 4 жыл бұрын
First!
@astronomers
@astronomers 4 жыл бұрын
Hi Sean, your videos are awesome. I think you are the right guy who can help me with this. There is a vertical scroll with images I want to display. But instead of this being a normal scrollview, I want the feature image to appear larger than the other images. And should the user scroll again a new feature image would appear larger. So after each scroll, a featured image would take centre stage. The feature image would also be locked to a certain position and size. I understand I might need to use GeometryReader for this? but you can advise. Please your help would be greatly appreciated. here is a screenshot of something similar, but in vertical, not horizontal. www.codeproject.com/KB/scripting/jquery-coverflow/screenshot1.JPG
Swift Closures: @escaping Explained
4:45
Sean Allen
Рет қаралды 45 М.
Swift For Beginners - Class & Inheritance Explained
15:42
Sean Allen
Рет қаралды 16 М.
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 7 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 10 МЛН
Why Is He Unhappy…?
00:26
Alan Chikin Chow
Рет қаралды 71 МЛН
لااا! هذه البرتقالة مزعجة جدًا #قصير
00:15
One More Arabic
Рет қаралды 20 МЛН
Swift - Result Type - Cleaner Network Calls
12:07
Sean Allen
Рет қаралды 20 М.
Swift - Class vs. Struct Explained
7:28
Sean Allen
Рет қаралды 31 М.
How to use Lazy in Swift
9:56
Sean Allen
Рет қаралды 39 М.
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 294 М.
Swift - Convenience Initializers
8:41
Sean Allen
Рет қаралды 18 М.
Swift Retain Cycle / Memory Leak Explained (iOS Interview Question)
9:05
Swift Closures Explained
14:23
Sean Allen
Рет қаралды 62 М.
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 7 МЛН