Toggling the Switch in code

See here for an advanced example