I made a struct Question
struct Question {
let imageView: UIImage
let textField: String
let textField2: String }
class SpellingViewController
class SpellingViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var theImage: UIImageView!
@IBOutlet weak var theInput: UITextField!
@IBOutlet weak var nextButton: UIButton!
@IBOutlet weak var progBar: UIProgressView!
var spellingScore: Int64 = 0
var questionNum = 0
let question = [
Question2(imageView: UIImage(named: "BeardQ")!, textField: "Beard", textField2: "beard"),
Question2(imageView: UIImage(named: "CastleQ")!, textField: "Castle", textField2: "castle"),
Question2(imageView: UIImage(named: "CloudQ")!, textField: "Cloud", textField2: "cloud"),
Question2(imageView: UIImage(named: "Elephant")!, textField: "Elephant", textField2: "elephant"),
Question2(imageView: UIImage(named: "RainQ")!, textField: "Rain", textField2: "rain")
] }
As you can see, I created this array and placed the UIImages inside it along with the textField and textField2. Simply, I'm gonna display an image to the user and I'm gonna take an input that describes the image and examine if it matches textField and textField2 or not. While running the simulator, I get the following error:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0x7f9987017e80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key imageView.' terminating with uncaught exception of type NSException
Is it because I'm using UIImage inside an array?