It copies the pointer to the instance. I just experienced it in the playground.
struct MyStruct { var instance: MyClass } class MyClass { var name: String init(name: String) { self.name = name println("inited \( self.name )")
What is different is that now there are two different links to the same object. Therefore, if you change one structure to another instance, you only hang it for this structure.
b.instance = MyClass(name: "Vik")
A playground is a great way to check such questions. I did not know the answer completely when I read this question. But now I am :)
So do not be afraid to play.
source share