The best way to use checkbox - IOS swift
<p>I am going to work on a project that will use a lot of checkboxes. I found a solution like below, but I know this not right way.</p>

<pre><code> @IBAction func btn_box(sender: UIButton) {
    if (btn_box.selected == true)
    {
        btn_box.setBackgroundImage(UIImage(named: "box"), forState: UIControlState.Normal)

            btn_box.selected = false;
    }
    else
    {
        btn_box.setBackgroundImage(UIImage(named: "checkBox"), forState: UIControlState.Normal)

        btn_box.selected = true;
    }
}
</code></pre>

<p>So, can anyone show me the right way of having more than 20 checkboxes in my project?</p>

<p>I will use checkboxes in forms and for settings purpose.</p>

<p>Thanks.</p>