[Solved] Swift Nested If statements do not compile


It should be like this:

func getWeight() -> String {
    if weightLabel.text == "Weight (lbs)" {
        if pickerView == heightPicker {
            let titleRow = height[row]
            return titleRow
        }
        else if pickerView == weightPicker {
            let titleRow = weight[row]
            return titleRow
        }
        return ""
    }
    else if weightLabel.text == "Weight (kgs)" {
        if pickerView == heightPicker {
            let titleRow = heightCM[row]
            return titleRow
        }
        else if pickerView == weightPicker {
            let titleRow = weightKG[row]
            return titleRow
        }
        return ""
    }
    return ""
}

0

solved Swift Nested If statements do not compile