Not sure how I ended up here, but I liked the video. This seems to be more about reference types vs value types and not really about the difference between the stack and the heap though...
It's not correct to say that the classes allocated on heap and structs are allocated on stack. It's incorrect, the allocation memory first of all depends on scope, and only secondly depends on data type. There are several cases when struct can be allocated on heap - when struct is a variable of class, or in escaping closure, or in inout param, etc. So it's an incorrect statement. The correct statement is that on the stack allocated function variables and arguments and on the heap allocated dynamic objects or objects that have some lifetime. So classes and structs it's about value and reference types, but not about stack and heap
That sound from Mario should play in all IDEs when there is an error, by default.
Not sure how I ended up here, but I liked the video. This seems to be more about reference types vs value types and not really about the difference between the stack and the heap though...
Hi John. Fair point. I focused on the reference vs value because to me, this is where stack vs heap affects the way you code.
Nice videos, really something that stands out from the other swift / iOS videos. Subscribed
Thank you Radu. So glad you found us. Welcome to the channel :)
Totally agree with this comment. Great job :)
Hi from Cyprus! I was looking for what is different class vs struct and i found you video. It's amazing!
Hello Cyprus! So glad you are here. Welcome to the channel.
Thanks you very much. Very informative video!
This was a very nice video. Thanks a lot!
this is very helpfull thanks for this video.
Very good content as usual! Thanks for sharing!!
Thank you Luis. All the best.
Thank you very much sir!
Hey you most welcome Matt. Thanks for stopping by. Love your movies! :)
👌👌👌👌Very nice and clear!!! Thank you :)
Thank you Amir. This was a fun one to make. Cheers.
Nice videos,
Great!
Thank you !
What about closures in structs?
It's not correct to say that the classes allocated on heap and structs are allocated on stack.
It's incorrect, the allocation memory first of all depends on scope, and only secondly depends on data type.
There are several cases when struct can be allocated on heap - when struct is a variable of class, or in escaping closure, or in inout param, etc.
So it's an incorrect statement. The correct statement is that on the stack allocated function variables and arguments and on the heap allocated dynamic objects or objects that have some lifetime.
So classes and structs it's about value and reference types, but not about stack and heap