Last active
August 29, 2015 14:22
-
-
Save fossil12/0a7620864b7c0f29bd55 to your computer and use it in GitHub Desktop.
Bug or error?
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 StructWithArray { | |
var arrayInStruct: [Int] | |
init() { | |
arrayInStruct = [Int]() | |
} | |
} | |
var structs = [StructWithArray()] | |
// playground crashes when using this line | |
structs[0].arrayInStruct.append(3) | |
// this works just fine | |
let count = structs[0].arrayInStruct.count | |
structs[0].arrayInStruct[count] = 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure. Is this an error on my side or a bug in Swift? My Playground always crashes when using this snippet.