Answered step by step
Verified Expert Solution
Link Copied!

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).

image text in transcribed

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 } 43

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions