File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Sources/DeclarativeLayoutKit/Chaining/Actions Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 8
8
import UIKit
9
9
10
10
11
- /// Add action to a UIGestureRecognizer.
11
+ /// **⚠️ Don't forget about ARC when use self or some parent view in action closure, to prevent retain cycle**
12
12
///
13
13
/// Using:
14
14
///
15
15
/// UIView()
16
- /// .addGesture(gesture: UITapGestureRecognizer()
17
- /// .addAction {
18
- /// // ...
19
- /// })
16
+ /// .addGesture(UITapGestureRecognizer()
17
+ /// .addAction {
18
+ /// // ...
19
+ /// })
20
20
extension UIGestureRecognizer {
21
21
func addAction( _ action: @escaping ( ) -> Void ) -> Self {
22
22
let action = ClosureAction ( attachTo: self , closure: action)
Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ public extension UIView {
35
35
return self
36
36
}
37
37
38
- func addGesture< Gesture: UIGestureRecognizer > ( overwrite: Bool = false , gesture: Gesture ) -> Self {
38
+ /// - Parameters:
39
+ /// - overwrite: if true - remove previous targets for current event.
40
+ @discardableResult
41
+ func addGesture< Gesture: UIGestureRecognizer > ( overwrite: Bool = false , _ gesture: Gesture ) -> Self {
39
42
addGestureRecognizer ( gesture)
40
43
return self
41
44
}
You can’t perform that action at this time.
0 commit comments