Detect either if UIButton is selected or what its background image is

I have a button that syncs my files. I need to wait out the sync if the sync is in progress. The only way I could think of doing it is by checking the changes that occur on the sync button.

When the sync button is clicked its selected property is set to true and the background image is changed and animated. What I believe I could do is detect either of them and wait for their state to change. However I don’t know how to get their state. At least for the selected property what I tries was:

var syncButton = driver.FindElementByAccessibilityId("Sync");
if (syncButton.GetAttribute("selected") == "true")
    Console.Write("Yes it is selected.");
    Console.Write("So sad, not selected.");

This code blows up because apparently there is no attribute with the name selected. syncButton.Selected doesn’t work as well.

The Accessibility Inspector shows the selected state under Traits but then again I don’t know if there is a way to check what the Traits of an element are.
As for detecting what is the background image I don’t know even where to begin.

I am currently researching how to use xpath and uiautomation to see if they could be of any use.

Having the same issue on the iOS side which seems to correlate with a React Native upgrade. No longer able to use element.get_attribute(‘value’) == ‘1’ or element.is_selected() to determine if a button element is selected. I was wondering if you found any workarounds for this issue?