This particular script will help you to implement a Value Change listener to all UISwitch and its subclasses in a clean way.
For further explaination on how this works, please read the article[UISwitch Value Change Listener : Swift] (/blogs/uiswitch-value-change-listener-swift/).