Не удается преобразовать значение типа в ожидаемый тип аргумента?

Я пытаюсь использовать функцию для установки свойств для разных кнопок. Вот область кода, в которой возникает ошибка:

@IBAction func pHTargetButton(sender: UIButton) { let buttonArray = [chemistryButton0!, chemistryButton1!, chemistryButton2!, chemistryButton3!, chemistryButton4!, chemistryButton5!] let chemistryViewChoice = [«pH»] for var i in 0..<buttonArray.count { setButton(ChemistryViewInfo, button: buttonArray[i], i) if buttonArray.count<5 { chemistryButton5?.backgroundColor = UIColor(red: 255, green: 255, blue: 255) chemistryButton5?.setTitle(«», forState: UIControlState.Normal) chemistryButton5?.alpha = 0.0} else{}}}

Ошибка возникает, когда я вызываю функцию setButton. Ошибка выделяет часть функции ChemistryViewInfo.

Ошибка:

Cannot convert value of type «ChemistryViewInfo.Type» to expected argument type «ChemistryViewInfo».

Вот функция, которую я создал и вызываю:

func setButton(viewInfo:ChemistryViewInfo,button:UIButton, index:Int) { let buttonInfo = viewInfo.buttons[index] button.titleLabel?.text = buttonInfo.scale button.backgroundColor = buttonInfo.color }

Мне интересно, связано ли это с ошибкой в ​​моем коде или я делаю неправильные вещи. У меня все кнопки указаны правильно, поэтому я знаю, что проблема не в этом. В любом случае, пожалуйста, помогите.

Любые предложения или отзывы приветствуются. Пожалуйста, опубликуйте измененный код в своем ответе.

Заранее спасибо.

ИЗМЕНИТЬ

Вот код, из которого я рисую:

struct ChemistryButtonInfo{ let scale: String let color: UIColor let levelExamp: String let levelInfo: String } struct ChemistryViewInfo { let text: String let description: String let buttons: [ChemistryButtonInfo] } let chemistryViewChoice = [«pH»: ChemistryViewInfo( text: «pH», description: «Most living things depend on proper pH level to sustain life.», buttons: [ ChemistryButtonInfo(scale: «6.2», color: UIColor(red: 212, green: 142, blue: 69), levelExamp: «Bread, Salmon, Potatoes, Normal Rain, Milk», levelInfo: «This level is not dangerous for humans. Only dangerous to some plant life.»), ChemistryButtonInfo(scale: «6.8», color: UIColor(red: 209, green: 122, blue: 31), levelExamp: «Milk and Human Saliva», levelInfo: «This level is not dangerous fr humans but on ly dangerouse to some plant life»), ChemistryButtonInfo(scale: «7.2», color: UIColor(red: 224, green: 80, blue: 9), levelExamp: «Blood, Human Tears, and Pure Water», levelInfo: «This level is not dangerous for humans. Only dangerous to few species of plant life.»), ChemistryButtonInfo(scale: «7.8», color: UIColor(red: 194, green: 74, blue: 58), levelExamp: «Sea Water and Eggs», levelInfo: «This level is not dangerous for humans, plants or fish»), ChemistryButtonInfo(scale: «8.4», color: UIColor(red: 208, green: 48, blue: 75), levelExamp: «Baking Soda and Phosphate Detergents», levelInfo: «This level is sometimes, in rare cases, dangerous for humans. Also dangerous to certain species of plant life and marine life.» )]),

Источник: ledsshop.ru

Стиль жизни - Здоровье!