How to add accessibility for UIRefreshControl in Swift

1.2k views Asked by At

I am trying to add accessibility for UIRefreshControl which has been implemented for pull to refresh in UITableView as below

self.refreshControl.accessibilityLabel = "Refreshing"

But if accessibility turned on and by swiping three finger on UITableview then does not speaking as Refreshing.

I override accessibilityScroll method as below.

override func accessibilityScroll(_ direction: UIAccessibilityScrollDirection) -> Bool {
    if direction == .up {
        self.refreshControl.accessibilityLabel = "Refreshing"
    }
    return true
}

Any idea Thanks!

1

There are 1 answers

1
Andrew McKinley On BEST ANSWER

Firstly, refreshing is more than just scrolling up. Its scrolling up past y position 0. Otherwise this will happen whenever the user scrolls up. Secondly, use UIAccessibilityPostNotification to announce to the user that a UI element has just changed.