Swift Struct vs. Class

I’ve been having a tough time in Swift with the Struct vs. Class issue. Unlike Java and Objective-C, Swift allows value type “classes” known as Struct types. These behave very similar to C++ objects that are created without dynamic memory allocation – in other words they’re created on the stack instead of the heap. This is nice and all but you immediately loose some very handy qualities of dynamically allocated objects such as their identity – their address in memory.

Well, I’m not alone in my dislike for structs. Today I came across this article that I thought I’d share: Stop Using Structs


Leave a Reply