Skip to content

Instantly share code, notes, and snippets.

@iosdevie
Created May 29, 2021 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iosdevie/cba414290d777dff6bc036f7979042e4 to your computer and use it in GitHub Desktop.
Save iosdevie/cba414290d777dff6bc036f7979042e4 to your computer and use it in GitHub Desktop.
class SwipeObserver : ObservableObject{
@Published var cards = [Cards]()
init() {
self.cards.append(Cards(id: 0, drag: 0, degree: 0, color: Color.purple))
//Skipping for brevity
}
func update(id : Cards,value : CGFloat,degree : Double){
for i in 0..<self.cards.count{
if self.cards[i].id == id.id{
self.cards[i].drag = value
self.cards[i].degree = degree
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment