I'm trying to enable the highlighted property of UILabels when the corresponding image from a randomly generated array is shown. The UILabels are located on a second ViewController.
My code works when the array shows "image 1", the UILabel with "1" enables the highlighted text property when the UILabel is on the same ViewController. It returns an error when the UILabel is on a second ViewController.
let checkVC = CheckNumbersController()
if mainImageView.image == #imageLiteral(resourceName: "1") {
checkVC.check1.isHighlighted = true
//'checkVC.check1.isHighlighted = true' is the line of code returning "Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value"
}
I greatly appreciate any assistance in advance.