Код: Выделить всё
func style() -> KeyValuePairs {
let values = ["a": Color.black, "b": Color.red] // this array is dynamic
return KeyValuePairs(dictionaryLiteral: values) // Cannot convert value of type '[String : Color]' to expected argument type '(String, Color)'
}
РЕДАКТИРОВАТЬ:
Это не тот же вопрос, потому что ссылка относится к функции .chartForegroundStyleScale(range:), и это не то же самое, что здесь. Кроме того (
Подробнее здесь: https://stackoverflow.com/questions/798 ... dictionary
Мобильная версия