Initialising empty arrays of dictionaries in Swift

后端 未结 6 1247
北恋
北恋 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:36

    You can use this if u want to use swift 2.3!

    let path = "/Library/Application Support/Apple/iChat Icons/Flags/"
    let image1 = UIImage(contentsOfFile: readPath + "Brazil.png")
    let image2 = UIImage(contentsOfFile: readPath + "Chile.png")
    
    var myImageArray = [UIImage]()
    myImageArray.append(image1)
    myImageArray.append(image2)
    

提交回复
热议问题