I'm getting this error "Missing return in a function expected to return 'NSAttributedString?'"
Can someone please help? I'm beating my small brain--prone to idiot mistakes--out over this thing. I put the "dummyString" line in to ensure there was a return, but no luck.
TIA
func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? {
let dummyString = "Dummy String"
if component == 1 {
return NSAttributedString(string: denomArray[row], attributes: [NSAttributedString.Key.foregroundColor: UIColor.yellow])
}else if component == 0 {
if issuerArray [row] == "US" {
return NSAttributedString(string: self.issuerArray[row], attributes: [NSAttributedString.Key.foregroundColor: BaseViewController.Flag.us.themeColor])
}
if issuerArray [row] == "Canada" {
return NSAttributedString(string: self.issuerArray[row], attributes: [NSAttributedString.Key.foregroundColor: BaseViewController.Flag.canada.themeColor])
}
}else{
return NSAttributedString(string: dummyString, attributes: [NSAttributedString.Key.foregroundColor: UIColor.red])
}
}
Aucun commentaire:
Enregistrer un commentaire