Initialising empty arrays of dictionaries in Swift

后端 未结 6 1288
北恋
北恋 2021-01-30 02:18

I\'m trying to wrap my head around initialising empty arrays in Swift.

For an array of strings it\'s pretty straight forward :

var myStringArray: String         


        
6条回答
  •  长发绾君心
    2021-01-30 02:42

    This will create an empty, immutable dictionary:

    let dictionary = [ : ]

    And if you want a mutable one:

    var dictionary = [ : ]

    Both of these dictionaries default to Dictionary.

提交回复
热议问题