Home > Blockchain >  how to get value from radio button to a variable in swift 5
how to get value from radio button to a variable in swift 5

Time:12-15

add tag from your interface builder

@IBAction func btnUserClicked(_ sender: UIButton) {
    //setValue(isUser: true)
    if(sender.tag == 0){
        strVal = "user"
        btnUser.setImage(UIImage(named: "circle-fill"), for: .normal)
        btnPropertyOwner.setImage(UIImage(named: "circle"), for: .normal)
    }
    else{
        strVal = "property user"
        btnPropertyOwner.setImage(UIImage(named: "circle-fill"), for: .normal)
        btnUser.setImage(UIImage(named: "circle"), for: .normal)
    }
}
  • Related