一个滑块允许用户只需触摸任意位置,即可轻松调整值

TouchSlider

让用户通过简单的点击,毫不费力地调整数值的滑块。


2023 年 10 月 6 日晚上 11 点 12 分 12 秒的 CleanShot

说明

@State var value: Double = 0

...

TouchSlider(
  direction: .horizontal,
  value: $touchSlider_value,
  speed: 1, // multiplier to track gesture translation.
  foregroundColor: Color.red,
  backgroundColor: Color(white: 0.5, opacity: 0.3),
  cornerRadius: 16
)
.frame(height: 80)

GitHub

点击跳转