Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Swift: Modify DoIncrease and DoDecrease functions so that the counter is limited in 0 and 20 (including 0 and 20). I do not need running
Swift:
Modify DoIncrease and DoDecrease functions so that the counter is limited in 0 and 20 (including 0 and 20).
I do not need running code.
9 import UIkit 10 11 class ViewController: UIViewController { 12 13 var counter: Int? 14 15 16 O O CIBOutlet weak var plus: UIButton! @IBOutlet weak var minus: UIButton! CIBOutlet weak var cntLabel: UILabel! 20 21 CIBAction func DoIncrease sender: Any) { 23 24 counter = counter! + 1 cntLabel.text = String(counter!) 25 26 27 28 } 29 30 O 32 33 34 CIBAction func DoDecrease ( _ sender: Any) { counter = counter! - 1 cntLabel.text = String(counter!) } override func viewDidLoad() { super.viewDidLoad() counter = 0 35 36 37 38 } 39 40 41 42 } 43Step 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