title: Why can you not initialize an empty Array in Swift?
body: <p>This code works,</p>
  
  <pre><code>let people = ["Tom","Dick","Harry"]
  </code></pre>
  
  <p>but this code doesn't work, for no apparent reason</p>
  
  <pre><code>let people = []
  </code></pre>
  
  <p>and nor does this (mutability matters not):</p>
  
  <pre><code>var people = []
  </code></pre>
  
  <p>The error is "Cannot convert expression's type Array to type 'ArrayLiteralConvertible'", but that makes no sense to me, and <a href="https://stackoverflow.com/questions/24094018/unable-to-create-array-of-skactions">none</a> of the <a href="https://stackoverflow.com/questions/25653462/how-to-put-an-uiimage-into-anyobject-array">other</a> <a href="https://stackoverflow.com/questions/24236492/storing-different-types-of-value-in-array-in-swift/24236512#24236512">questions</a> that show up in a search address this question.</p>
  
  <p>At first I thought it had to do with type inference, but that proves not to be the issue (at least not simply that!) since although this works (with type specified)</p>
  
  <pre><code>var people:Array = [""]
  </code></pre>
  
  <p>this does not (with type specified as above but no String given inside the Array):</p>
  
  <pre><code>var people:Array = []
  </code></pre>
  
  <p>Since the last of these two has the type specified explicitly, it shouldn't need a String passed inside the Array.</p>
  
  <p>Some languages (weirdly!) consider the type of the variable to refer to the type of item <strong><em>inside</em></strong> the array, so I also tried specifying <code>String</code> instead of <code>Array</code>, but got the same results.  This first one works and the second doesn't:</p>
  
  <pre><code>var people:String = [""]
  </code></pre>
  
  
  
  <pre><code>var people:String = []
  </code></pre>