I\'m really confused with the ways we create an array in Swift. Could you please tell me how many ways to create an empty array with some detail?
Compatible with: Xcode 6.0.1+
You can create an empty array by specifying the Element type of your array in the declaration.
For example:
// Shortened forms are preferred
var emptyDoubles: [Double] = []
// The full type name is also allowed
var emptyFloats: Array = Array()
Example from the apple developer page (Array):
Hope this helps anyone stumbling onto this page.