【发布时间】:2015-06-17 08:27:09
【问题描述】:
这样可以返回字典吗? 我想这只是我弄错了一些语法。
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)))]
}
}
【问题讨论】:
-
与论坛网站不同,我们不使用“谢谢”、“任何帮助表示赞赏”或Stack Overflow 上的签名。请参阅“Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?.
标签: arrays swift dictionary random