[TIMOB-14178] Added support for switch

Original PR: https://github.com/appcelerator/titanium_mobile/pull/6324
This PR has minor changes in addition to the above PR.