Botão Switch Swift 5

 @IBAction func switch(_ sender: Any) {
          if ((sender as AnyObject).isOn == true) {
         //Yes
          } else {
            //No
          }
    }
Lazy Lizard