Skip to content

Instantly share code, notes, and snippets.

@koher
Created January 25, 2018 01:53
Show Gist options
  • Save koher/f80a6e54b750043c034e53fcfbe82901 to your computer and use it in GitHub Desktop.
Save koher/f80a6e54b750043c034e53fcfbe82901 to your computer and use it in GitHub Desktop.
struct Person {
var name: String
var age: Int
}
var a = [
Person(name: "Foo", age: 20),
Person(name: "Bar", age: 30),
]
var b = a
b[0].age += 1
print(a[0].age) // 20
print(b[0].age) // 21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment