I am trying to get a random string from array "firstArray" and print it in UILabel "label". I cannot seem to figure it out and I get errors. Your help is appreciated. I tried searching but could not find any up-to-date tutorials/methods.
import UIKit
class ViewController: UIViewController {
@IBOutlet var label: UILabel!
@IBAction func random(_ sender: Any) {
let firstArray = [ "hi" , "bye" , "hello"]
}
IBActionmethodrandom, you see people don't even know where you want to implement the random function. Write another function calledrandom, then put it inside thatIBAction, it'll be easier for you to read later on :)