LucasC
LucasC

Reputation: 53

Modify ProgressView with drag gestures in SwiftUI

Any idea how to modify (if is possible) a ProgressView with drag gestures. To begin with, I think the code will be something like this:

ProgressView(value: progress)
  .gesture(DragGesture()
        .onChanged({ 

              // code here

        })

But I'm really lost. Any help?

Upvotes: 0

Views: 666

Answers (1)

sheldor
sheldor

Reputation: 159

The .onChanged modifier has a parameter in the closure. You can do something like:

.onChanged{ val in
    progress = val.translation.width / 100 // perhaps cut it so the number is between 0 and 1
}

Upvotes: 0

Related Questions