Skip to content

Instantly share code, notes, and snippets.

@dirn
Created July 18, 2014 16:26
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 dirn/78f10661ccee1dbe19ef to your computer and use it in GitHub Desktop.
Save dirn/78f10661ccee1dbe19ef to your computer and use it in GitHub Desktop.
Mutating a Swift struct
struct Foo {}
struct Bar {
var data: [Foo]
init() {
data = [Foo](count: 5, repeatedValue: Foo())
}
mutating func test() {
data[2] = Foo()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment