var x : [T] =  or var x = [T]() smackdown #swiftlang Have your say. Which one? var x : [T] =  var x = [T]() var x: Array<T>=  var x = Array<T>() Something else. See comments. pollcode.com free polls Share this:Click to share on Twitter (Opens in new window)Click to share on Facebook (Opens in new window) Related September 22, 2015 By erica Development, Swift 2 Comments Tweet this Post It’s a Cocoa thing: Print and NSView #swiftlangIt’s a Cocoa thing: Print and NSView #swiftlang
If a function returns an array of type `T` and you want to return an empty array, you would write `return ` and not `return [T]()`.
Why should initialization be any different?
Because the type is already determined when returning – it always will be.
On initialization we try to infer the type – var x = [T]() follows the same convention.