Skip to content

Commit

Permalink
Sort if buttons toggle when pressed or released (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfikes authored Jan 28, 2024
1 parent 9eb1352 commit cd3f3ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Impedance Converter/Impedance Converter/ButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ struct ButtonView: View {
if (!self.isPressed) {
self.isPressed = true
Haptics.shared.playHapticFeedback(for: self.isPressed)
action()
}
})
.onEnded({ _ in
self.isPressed = false
Haptics.shared.playHapticFeedback(for: self.isPressed)
action()
})
)
}
Expand Down Expand Up @@ -127,12 +127,12 @@ struct ToggleButtonView: View {
if (!self.isPressed) {
self.isPressed = true
Haptics.shared.playHapticFeedback(for: self.isPressed)
self.isOn.toggle()
}
})
.onEnded({ _ in
self.isPressed = false
Haptics.shared.playHapticFeedback(for: self.isPressed)
self.isOn.toggle()
})
)
}
Expand Down

0 comments on commit cd3f3ae

Please sign in to comment.