Parameters
A string representing the current value of the accessibility element. Used for controls like sliders, progress bars, and other value-based components.
Sets the current value of this accessibility element.
.accessibilityValue(value: string): Component;
Slider(value: $volume, in: 0...100)
.accessibilityLabel("Volume")
.accessibilityValue(`${volume}%`)
ProgressView({ value: progress })
.accessibilityLabel("Upload progress")
.accessibilityValue(`${Math.round(progress * 100)}% complete`)
HStack([
ForEach(0..<5, (index) =>
Image(index < rating ? "star-filled" : "star-empty")
)
]).accessibilityLabel("Rating")
.accessibilityValue(`${rating} out of 5 stars`)
Toggle("Dark mode", isOn: $isDarkMode)
.accessibilityValue(isDarkMode ? "On" : "Off")
VStack([
Text("Temperature"),
Text(`${temperature}°F`)
]).accessibilityLabel("Current temperature")
.accessibilityValue(`${temperature} degrees Fahrenheit`)
DatePicker("Select date", selection: $selectedDate)
.accessibilityValue(selectedDate.formatted(date: .complete, time: .omitted))