how to enable button when all textfields filled in tableviewcell(SWIFT)

Solution:

The below function is used to check the that all textfields are filled in a tableViewCell.You can pass the cell to the function it will return the boolean when one textfield is empty .Otherwise it will return true.


func enableBtn(cell:UITableViewCell)->Bool{
        var isEnable:Bool = true
        for textF in cell.subviews {
            if textF.isKind(of: UITextField) {
                let textFild = textF as! UITextField
                if textFild.text == "" {
                    isEnable = false
                    return isEnable
                }
            }
        }
        return isEnable
    }

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift