There's a ton of discussion in the Swift world about when to use structs and when to use classes. And I just don't understand why.
Use structs when you want value semantics. Use classes when you want reference semantics. Boom. Done.
All the confusion and discussion and fighting seems to be because people don't understand the implications of value versus reference semantics, and instead of learning they try to come up with ad hoc rules and guidelines that will let them decide without understanding the actual differences.
Use structs when you want value semantics. Use classes when you want reference semantics. Boom. Done.
All the confusion and discussion and fighting seems to be because people don't understand the implications of value versus reference semantics, and instead of learning they try to come up with ad hoc rules and guidelines that will let them decide without understanding the actual differences.