JunichiT/JTMaterialSwitch

How to find which switch delegate called?

mathiarasan24 opened this issue · 2 comments

Hi,

I am using multiple switch in same view. So I don't know which switch delegate called when switch state change. If any way to find that let me know if I miss anything.

Thanks,

hi
you can write two @IBAction func one of each switch then use the addTarget(self, action:#selector(), for: .valueChanged) function to declare the action for each switch

as following

FirstSwitch?.addTarget(self, action: #selector(FirstBtnSwitch), for: UIControlEvents)

@IBAction func FirstBtnSwitch(_ sender: JTMaterialSwitch) {
print("FirstBtnSwitch")

}

use .tag property to identify