2 Replies
      Latest reply on Aug 31, 2019 4:54 AM by RomanBeginner
      RomanBeginner Level 1 Level 1 (0 points)

        //An error appears in the code. I'm an aspiring developer. Learn. The application uses UITextField to enter the minimum and maximum range of numbers. Then a random number from this range should be written to the Label.

         

        import UIKit

        import GameplayKit

         

        class ViewController: UIViewController {

         

            @IBOutlet weak var labelResult: UILabel!

            @IBOutlet weak var imageView: UIImageView!

            @IBOutlet weak var textFieldFrom: UITextField!

            @IBOutlet weak var textFieldTo: UITextField!

            @IBOutlet weak var actionButton: UIButton!

         

          

            override func viewDidLoad() {

                super.viewDidLoad()

              

              

                labelResult.font = labelResult.font.withSize(30)

              

                actionButton.setTitleColor(.white, for: .normal)

                actionButton.backgroundColor = .blue

              

            }

         

            @IBAction func selectionButton(_ sender: Any) {

              

                textFieldTo.text = "100"

                textFieldFrom.text = "0"

              

                var lowestValue: Int? = Int(textFieldFrom.text!)

                var highesttValue :Int? = Int(textFieldTo.text!)

              

               labelResult.text = "\( init(randomSource: GKRandom, lowestValue: lowestValue, highestValue: highesttValue))". //Problem

             

            }

          

        }