let hopAnimation:[UIImage] = UIImage(named:"background")
I do this but Xcode tells me:
Expected ',' separator Fix-it insert ','
I tried your code.It showed me the Cannot convert value of type 'UIImage?' to specified type '[UIImage]'
. Then I removed the [UIImage]
let hopAnimation = UIImage(named:"background")
Now it does not show the error
I must tell that
[UIImage] is an array of images.Here you are not creating array of image.You create only image.So remove the array of images.
[UIImage]
declares an array of images. To create a single image, use:
var hopAnimation = UIImage(named:"background")
[UIImage]
is an array of images. Justlet hopAnimation = ...
let hopAnimation = UIImage(named:"background")
Try this code.