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 {
138
138
_ touches: Set < UITouch > ,
139
139
with event: UIEvent ?
140
140
) {
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
-
149
141
super. touchesBegan ( touches, with: event)
142
+
143
+ guard self . model. isTappable else { return }
144
+
150
145
self . isPressed = true
151
146
}
152
147
153
148
open override func touchesEnded(
154
149
_ touches: Set < UITouch > ,
155
150
with event: UIEvent ?
156
151
) {
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 }
164
155
165
156
defer { self . isPressed = false }
166
157
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) {
169
161
self . onTap ( )
170
162
}
171
- super. touchesEnded ( touches, with: event)
172
163
}
173
164
174
165
open override func touchesCancelled(
You can’t perform that action at this time.
0 commit comments