mercredi 17 juin 2015

How to check bool inside of dictionary

I have the following piece of code:

struct Dare {
  var theDare: [[String: AnyObject]] = [
    ["dare": "Dare1",
     "darePerson": true],
    ["dare": "Dare2",
     "darePerson": false],
    ["dare": "Dare3",
     "darePerson": false],
    ["dare": "Dare4",
     "darePerson": true],
    ["dare": "Dare5",
     "darePerson": false]
]

func randomDare() -> Dictionary<String, AnyObject> {
    return theDare[Int(arc4random_uniform(UInt32(theDare.count)))]
}

}

How can i check a random dare if darePerson == true?




Aucun commentaire:

Enregistrer un commentaire