let fortuneArray = ["You will find true love in the summer.", "Outlook not good", "You may find great success in business soon.", "Watch out for grey cats."]
let randomIndex = Int(arc4random_uniform(fortuneArray.count))
I'm creating a very simple fortune telling app in Swift and I keep running into issues with arc4random_uniform
. Currently I'm just trying to get the app to draw a string at random but I get an error saying:
Instance member 'fortuneArray' cannot be used on type 'ViewController'
on the line where I am declaring the variable randomIndex
. I've been using google for awhile but haven't found a fix. Hopefully someone can help, thanks!
Aucun commentaire:
Enregistrer un commentaire