Posts

Post not yet marked as solved
7 Replies
Thanks for the suggestion, I'll look into implementing this with UIKit although would be nice to be able to do it in SwiftUI
Post not yet marked as solved
7 Replies
With the following; var body: some View { let padGesture = LongPressGesture(minimumDuration: 0.1, maximumDistance: 100) .onEnded { _ in self.color = self.defaultColor } .onChanged { _ in self.color = self.activeColor } return Rectangle() .onAppear{ self.color = self.defaultColor } .foregroundColor(self.color) .gesture(padGesture) }When the pad is pressed then it changes color to activeColor but after minimumDuration it resets to defaultColor.
Post not yet marked as solved
7 Replies
I don't think that's what I'm really looking for... I want to be able to tell when the the element is touched and when it loses touch.