---
title: Day 34
author: Daniel Devesa Derksen-Staats
date: 2022-06-21 13:12
tags: accessibilityValue, adjustable, iOS
categories: ["Accessibility"]
series: ["365 Days iOS Accessibility"]
image: /Images/365DaysIOSAccessibility/image169.jpg
---

UISliders are adjustable, and its default accessibility value is represented in percentages. But that's not always the best format to express a value. Consider a slider to select a distance radius. Miles or km seem a more appropriate unit.  

![A slider is used to select a distance radius of 5 km. In code, the accessibilityValue property of the slider is updated using a Measurement Formatter to get the value as kilometres when the user interacts with the slider.](/Images/365DaysIOSAccessibility/image169.jpg)

[Example code in the image:](https://gist.github.com/dadederk/1fa9f790900967e61f25c9808389ab81)

```swift
override var accessibilityValue: String? {
    get {
        let formatter = MeasurementFormatter()
        let measurement = Measurement<UnitLength>(
          value: Double(value),
          unit: .kilometers
        )
        formatter.unitStyle = .long
        return formatter.string(from: measurement)
      }
    set {}
}
```

