How do I initialize an Array in swift with a specific capacity?
I've tried:
var grid = Array <Square> () grid.reserveCapacity(16)
but get the error
expected declaration
Swift 3 / Swift 4 / Swift 5
var grid : [Square]? grid?.reserveCapacity(16)
I believe it can be achieved in one line as well.
2.1m questions
2.1m answers
60 comments
57.0k users