Skip to content

Instantly share code, notes, and snippets.

@josephlord
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save josephlord/07462093db0305b3fd06 to your computer and use it in GitHub Desktop.

Select an option

Save josephlord/07462093db0305b3fd06 to your computer and use it in GitHub Desktop.
Swift Arrays Beta 3 (syntax)
// Note in Swift you usually don't have to state the type it can be inferred but it is useful to be able to do so if you are assigning an empty collection. It can also be necessary in function declarations.
// Beta 1 and 2
var c:Int[] = []
// No way of specifiying type really just create the instance of the generic and let type inference define the type of d.
var d = Dictionary<Int:String>()
// Beta 3
var c:[Int] = []
var d:[Int:String] = [:]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment