Created
July 18, 2014 16:26
-
-
Save dirn/78f10661ccee1dbe19ef to your computer and use it in GitHub Desktop.
Mutating a Swift struct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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