Why is my image not being appended to the array?

前端 未结 2 1567
后悔当初
后悔当初 2021-01-22 14:05

I\'ve a simple model that includes:

var photos: [UIImage]?

I\'ve copied the file zombies.jpg as a file into the project. Then, in a required in

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-22 14:35

    Better do this:

    var photos : [UIImage?] = []
    

    It initializes an empty array, that is ready to store UIImage objects.

提交回复
热议问题