File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
1
Pod ::Spec . new do |s |
2
2
s . name = "KWStepper"
3
- s . version = "2.3 .0"
3
+ s . version = "2.4 .0"
4
4
s . summary = "A stepper control with flexible UI and tailored UX."
5
5
s . homepage = "https://github.com/kyleweiner/KWStepper"
6
6
s . license = { :type => "MIT" , :file => "LICENSE" }
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ Adopting `KWStepperDelegate` provides the following optional delegate methods fo
114
114
* ` optional func KWStepperDidIncrement() `
115
115
* ` optional func KWStepperMaxValueClamped() `
116
116
* ` optional func KWStepperMinValueClamped() `
117
+ * ` optional func KWStepperDidEndLongPress() `
117
118
118
119
### Callbacks
119
120
@@ -124,6 +125,7 @@ KWStepper provides the following callbacks:
124
125
* ` incrementCallback `
125
126
* ` maxValueClampedCallback `
126
127
* ` minValueClampedCallback `
128
+ * ` longPressEndedCallback `
127
129
128
130
Method chaining is supported for callbacks too:
129
131
@@ -134,6 +136,7 @@ stepper
134
136
.didIncrement { _ in }
135
137
.maxValueClamped { _ in }
136
138
.minValueClamped { _ in }
139
+ .longPressEnded { _ in }
137
140
138
141
// `maxValueClampedCallback` and `minValueClampedCallback` may be set simultaneously.
139
142
stepper.valueClamped { stepper in
Original file line number Diff line number Diff line change @@ -129,6 +129,14 @@ extension KWStepper {
129
129
return self
130
130
}
131
131
132
+ /// Sets the stepper's `longPressEndedCallback`.
133
+ @discardableResult
134
+ public func longPressEnded( _ callback: KWStepperCallback ? ) -> Self {
135
+ longPressEndedCallback = callback
136
+
137
+ return self
138
+ }
139
+
132
140
// MARK: - Convenience Methods
133
141
134
142
/// Sets the stepper's `decrementStepValue` and `incrementStepValue`.
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ import UIKit
20
20
21
21
/// Called when `value` is clamped to `minimumValue` via `decrementValue()`.
22
22
@objc optional func KWStepperMinValueClamped( )
23
+
24
+ /// Called when a long press gesture ends.
25
+ @objc optional func KWStepperDidEndLongPress( )
23
26
}
24
27
25
28
/// A stepper control with flexible UI and tailored UX.
@@ -130,6 +133,9 @@ public class KWStepper: UIControl {
130
133
/// Executed when `value` is clamped to `minimumValue` via `decrementValue()`.
131
134
public var minValueClampedCallback : KWStepperCallback ?
132
135
136
+ /// Executed when a long press gesture ends.
137
+ public var longPressEndedCallback : KWStepperCallback ?
138
+
133
139
// MARK: - Private Variables
134
140
135
141
fileprivate var longPressTimer : Timer ?
@@ -251,6 +257,9 @@ extension KWStepper {
251
257
252
258
timer. invalidate ( )
253
259
longPressTimer = nil
260
+
261
+ delegate? . KWStepperDidEndLongPress ? ( )
262
+ longPressEndedCallback ? ( self )
254
263
}
255
264
}
256
265
You can’t perform that action at this time.
0 commit comments