
struct
2
MENTIONS
1
EPISODES
1
PODCASTS
Search complete. 2 mentions across 1 episode found for "struct".
Oct 17, 2026
Stanford CS193p: iOS Development with SwiftUI | 2025 | L3: Model and UI and Swift Type System
P
39:43Paul HegartyHOST
That's the way reference works, and this is the way your code you're used to writing would work.
P
39:47Paul HegartyHOST
But let's see the same thing with structs.
P
39:49Paul HegartyHOST
Structs are always copied, and if it's a let, it's immutable.
P
39:52Paul HegartyHOST
So here, if I have let house equal big structure, let's say that's a struct, then I say house.floors equals two will actually not even compile if I put it in a let.
P
40:03Paul HegartyHOST
See, I let house equal that, house.floors equals two, because let is not mutable.
P
44:16Paul HegartyHOST
It's the same pointer, so that is an identity for that thing that lives in the heap.
P
44:21Paul HegartyHOST
You know, like in For Each, remember in For Each, we had to do ID self, and we had to kinda s- tell the For Each thing what-- how to identify each of the things in the collection, so it could match them up with the views? Well, when we do a For Each, which is a collection of classes, boy, it's really easy to provide identity there, right? Because classes, very strong identity.
P
44:42Paul HegartyHOST
Structs have no sense of identity, zero, at all.