mercredi 17 juin 2015

How to return random dictionary

Is it possible to return a dictionary this way? i guess it's just some syntax i got wrong.

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

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

}

thanks in advance! :)




Aucun commentaire:

Enregistrer un commentaire