How do I swipe a XCUIElementTypeSwitch control?

I am trying to use cast the WebElement to MobileElement and use swipe() but that method has been deprecated

hey jblaze,

Here is how i scroll down on a specific element. The code is in c#

public static void SwipeElement(IWebElement element, SwipeDirection direction)
{
if (BuildInfo.isAndroid())
{
element = (AndroidElement)element;
}
else if (BuildInfo.isIOS())
{
element = (IOSElement)element;
}

        ITouchAction action = new TouchAction(BaseClass.driver);

        if (BuildInfo.isIOS())
        {
            action.Tap(element);
            action.Wait(200);
        }

        if (direction == SwipeDirection.Up)
        {
            action.Press(element, element.Size.Width / 2, element.Size.Height * .9);
            action.Wait(200);
            action.MoveTo(element, element.Size.Width / 2, element.Size.Height * .1);
        }
        else if (direction == SwipeDirection.Down)
        {
            action.Press(element, element.Size.Width / 2, element.Size.Height * .1);
            action.Wait(200);
            action.MoveTo(element, element.Size.Width / 2, element.Size.Height * .9);
        }

        action.Release();
        action.Perform();
    }