Question
// // ViewController.swift // Gill.light // // Created by Amado Gil on 2/20/23. // import UIKit class ViewController: UIViewController { var lightOn = true override
//
// ViewController.swift
// Gill.light
//
// Created by Amado Gil on 2/20/23.
//
import UIKit
class ViewController: UIViewController {
var lightOn = true
override func viewDidLoad() {
super.viewDidLoad()
updateUI()
// Do any additional setup after loading the view.
}
func updateUI() {
view.backgroundColor = lightOn ? .white : .black
}
@IBAction func buttonPressed(_ sender: UIButton) {
lightOn.toggle()
updateUI()
}
}
SWIFT LANGUAGE
By the end of this guided project, you'll have created an app named Light that changes the screen from black to white and back again when the user taps a button.
I'm having issued with my application running properly. When I run simulator, an error shows (see picture attached). Please help find solution to fix this.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started