'_' 不可转换为 StringLiteralConvertible
'_' is not convertible to StringLiteralConvertible
我的自定义函数如下:
func mockDictionaryForLocation() -> [String: AnyObject] {
let dictionary = [
"id" = "1234", //here I have an error from the title, why?
"working_type" = "open_for_selected",
"min_order_price" = 15,
"specialization_breakfasts" = 1,
"specialization_confectioneries" = 1,
"specialization_dinners" = 0
]
return dictionary
}
您需要使用冒号而不是等号:
func mockDictionaryForLocation() -> [String: AnyObject] {
let dictionary = [
"id": "1234",
"working_type": "open_for_selected",
"min_order_price": 15,
"specialization_breakfasts": 1,
"specialization_confectioneries": 1,
"specialization_dinners": 0
]
return dictionary
}
我的自定义函数如下:
func mockDictionaryForLocation() -> [String: AnyObject] {
let dictionary = [
"id" = "1234", //here I have an error from the title, why?
"working_type" = "open_for_selected",
"min_order_price" = 15,
"specialization_breakfasts" = 1,
"specialization_confectioneries" = 1,
"specialization_dinners" = 0
]
return dictionary
}
您需要使用冒号而不是等号:
func mockDictionaryForLocation() -> [String: AnyObject] {
let dictionary = [
"id": "1234",
"working_type": "open_for_selected",
"min_order_price": 15,
"specialization_breakfasts": 1,
"specialization_confectioneries": 1,
"specialization_dinners": 0
]
return dictionary
}