Has not initializers - Swift IOS

0

Good morning, friends.

For some reason, I'm having this error, since I'm new to this platform, I can not identify the problem, could someone help me please?

Thank you!

    
asked by anonymous 21.01.2016 / 13:42

1 answer

3

The image variable needs to be initialized in your build or inside the class constructor, or you can say that it can be optional as follows:

var image: UIImage?

In this way you will have to check if it is not null when it will be used, or you can declare it:

var image: UIImage!

So you guarantee that it will be initialized in use, but if it is not it will give error.

    
21.01.2016 / 13:58