You have initialize photos array, and you are using conditional unwrapping, which means if its not nil append but your photos array is nil at the time so it will not append a photo in nil array. You should do something like this var photos:[UIImage] = []