Learn Courses My Dashboard

To Struct Or Not to Struct

So I’m reading up on Apple documentation. And I thought I’d ask fellow developers their thoughts.
Documentation Page

So basically it point out if you need to use identity with whatever data you have then use a Class. This is something Chris made note of too. However, what does Identity encompass? UUID’s?

The page also highlights how it’s recommended to use Struct when we can. But Struct can use UUID’s as well.

Use structures for pretty much making any models. I highly doubt you’ll need Objective-C, so don’t worry about that.

Use structs for pretty much all models, and a class for most “view models” in SwiftUI.

1 Like