Trying to make a loader using animation trough this code:
var images: [UIImage] = []
for i in 1...10
{
let strImageName : String = "loader\(i).png"
images.append(UIImage(named: strImageName)!)
}
self.loader.animationImages = images
self.loader.animationDuration = 1.0
self.loader.startAnimating()
I got this error fatal error: "unexpectedly found nil while unwrapping an Optional value Then my application crashed" and those information from the debugger after the crash:
images = ([UImage]) 0 values
strImageName = (String) “loader1.png”
I can’t understand what is wrong in my code. Can anyone help me please?