diff --git a/Sources/ComponentsKit/Components/Button/UKButton.swift b/Sources/ComponentsKit/Components/Button/UKButton.swift index 560836f..747897b 100644 --- a/Sources/ComponentsKit/Components/Button/UKButton.swift +++ b/Sources/ComponentsKit/Components/Button/UKButton.swift @@ -199,7 +199,13 @@ open class UKButton: FullWidthComponent, UKComponent { ) { super.touchesCancelled(touches, with: event) - self.isPressed = false + defer { self.isPressed = false } + + if self.model.isInteractive, + let location = touches.first?.location(in: self), + self.bounds.contains(location) { + self.action() + } } open override func traitCollectionDidChange( diff --git a/Sources/ComponentsKit/Components/Card/UKCard.swift b/Sources/ComponentsKit/Components/Card/UKCard.swift index a9f6355..8c620dd 100644 --- a/Sources/ComponentsKit/Components/Card/UKCard.swift +++ b/Sources/ComponentsKit/Components/Card/UKCard.swift @@ -170,7 +170,15 @@ open class UKCard: UIView, UKComponent { ) { super.touchesCancelled(touches, with: event) - self.isPressed = false + guard self.model.isTappable else { return } + + defer { self.isPressed = false } + + if self.model.isTappable, + let location = touches.first?.location(in: self), + self.bounds.contains(location) { + self.onTap() + } } open override func traitCollectionDidChange(