Skip to content

Instantly share code, notes, and snippets.

@roop
Created June 26, 2014 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roop/3b8f745606baac5ef461 to your computer and use it in GitHub Desktop.
Save roop/3b8f745606baac5ef461 to your computer and use it in GitHub Desktop.
struct MyStruct {
var value: Int = 0
}
var instanceOfMyStruct = MyStruct(value: 42)
var assignedInstance1 = instanceOfMyStruct
assignedInstance1.value = 2 // Change the copied instance
instanceOfMyStruct.value // 42: Original is unchanged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment