File tree Expand file tree Collapse file tree 1 file changed +9
-18
lines changed
Sources/ComponentsKit/Components/Card Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -138,37 +138,28 @@ open class UKCard<Content: UIView>: UIView, UKComponent {
138138 _ touches: Set < UITouch > ,
139139 with event: UIEvent ?
140140 ) {
141- guard self . model. isTappable,
142- let touch = touches. first,
143- touch. view == self
144- else {
145- super. touchesBegan ( touches, with: event)
146- return
147- }
148-
149141 super. touchesBegan ( touches, with: event)
142+
143+ guard self . model. isTappable else { return }
144+
150145 self . isPressed = true
151146 }
152147
153148 open override func touchesEnded(
154149 _ touches: Set < UITouch > ,
155150 with event: UIEvent ?
156151 ) {
157- guard self . model. isTappable,
158- let touch = touches. first,
159- touch. view == self
160- else {
161- super. touchesEnded ( touches, with: event)
162- return
163- }
152+ super. touchesEnded ( touches, with: event)
153+
154+ guard self . model. isTappable else { return }
164155
165156 defer { self . isPressed = false }
166157
167- let location = touch. location ( in: self )
168- if bounds. contains ( location) {
158+ if self . model. isTappable,
159+ let location = touches. first? . location ( in: self ) ,
160+ self . bounds. contains ( location) {
169161 self . onTap ( )
170162 }
171- super. touchesEnded ( touches, with: event)
172163 }
173164
174165 open override func touchesCancelled(
You can’t perform that action at this time.
0 commit comments