Skip to content

Commit c153a3d

Browse files
committed
Adding Doc comments
1 parent a82f9b9 commit c153a3d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Sources/DeclarativeLayoutKit/Chaining/Actions/UIGestureRecognizer+Action.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
import UIKit
99

1010

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**
1212
///
1313
/// Using:
1414
///
1515
/// UIView()
16-
/// .addGesture(gesture: UITapGestureRecognizer()
17-
/// .addAction {
18-
/// // ...
19-
/// })
16+
/// .addGesture(UITapGestureRecognizer()
17+
/// .addAction {
18+
/// // ...
19+
/// })
2020
extension UIGestureRecognizer {
2121
func addAction(_ action: @escaping () -> Void) -> Self {
2222
let action = ClosureAction(attachTo: self, closure: action)

Sources/DeclarativeLayoutKit/Chaining/Actions/UIView+Gesture.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public extension UIView {
3535
return self
3636
}
3737

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 {
3942
addGestureRecognizer(gesture)
4043
return self
4144
}

0 commit comments

Comments
 (0)