Skip to content

Commit 4377bda

Browse files
Update
1 parent a6fe5aa commit 4377bda

24 files changed

+91
-101
lines changed

ButtonClickStyle.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Pod::Spec.new do |s|
1010
s.name = 'ButtonClickStyle'
1111
s.version = '1.1.0'
12-
s.summary = 'This is a customizable designable button view. Inside layer you can style button, create your own subviews. Choose 9 click animation styles'
12+
s.summary = 'This is a customizable designable button view. Inside layer you can style button, create your own subviews. Choose 15 click animation styles'
1313

1414
# This description is used to generate tags and improve search results.
1515
# * Think: What does it do? Why did you write it? What is the focus?
@@ -32,7 +32,7 @@ Pod::Spec.new do |s|
3232
# s.ios.deployment_target = '14.0'
3333
s.platform = :ios, "14.0"
3434

35-
s.source_files = 'Source/**/*.{swift}'
35+
s.source_files = 'Source/ButtonClickStyle/**/*.{swift}'
3636

3737
# s.resource_bundles = {
3838
# 'ButtonClickStyle' => ['ButtonClickStyle/Assets/*.png']

Example/ButtonClickStyle.xcodeproj/project.pbxproj

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -234,44 +234,46 @@
234234
4A14CBC22803437C00DA8A68 /* ButtonClickStyle */ = {
235235
isa = PBXGroup;
236236
children = (
237-
4A14CBCF2803437C00DA8A68 /* Animations */,
238-
4A62F30C2803115C00534ABA /* UIDesignable */,
239-
4A14CBC42803437C00DA8A68 /* Style */,
237+
4A14CBD02803437C00DA8A68 /* UIView+AnimationAlpha.swift */,
238+
4A14CBD12803437C00DA8A68 /* UIView+AnimationShadow.swift */,
239+
4A14CBD22803437C00DA8A68 /* UIView+AnimationPulsate.swift */,
240+
4A14CBD32803437C00DA8A68 /* UIView+AnimationAndroidPulse.swift */,
241+
4A14CBD42803437C00DA8A68 /* UIView+AnimationColor.swift */,
242+
4A14CBD52803437C00DA8A68 /* UIView+AnimationPulse.swift */,
243+
4A14CBD62803437C00DA8A68 /* UIView+AnimationColorFlat.swift */,
244+
4A14CBD72803437C00DA8A68 /* UIView+AnimationSnake.swift */,
245+
4A14CBD82803437C00DA8A68 /* UIView+AnimationFlash.swift */,
246+
4A14CBD92803437C00DA8A68 /* UIView+AnimationPress.swift */,
247+
4A85B5A22803D59800DFD435 /* UIView+AnimationGlare.swift */,
248+
4A62F30D2803115C00534ABA /* ButtonClickStyleDesignLabel.swift */,
249+
4A62F30E2803115C00534ABA /* ButtonClickStyleDesignView.swift */,
250+
4A14CBC52803437C00DA8A68 /* ButtonClickStyleShort.swift */,
251+
4A14CBC62803437C00DA8A68 /* ButtonClickStyle.swift */,
252+
4A231B79280A82250073284C /* ButtonClickStyleEmoji.swift */,
253+
4A14CBC72803437C00DA8A68 /* ButtonClickStyleBase.swift */,
254+
4A14CBC92803437C00DA8A68 /* ButtonClickStyleGestureRecognizer.swift */,
240255
4A14CBCE2803437C00DA8A68 /* ButtonClickStyleAddViewsAnimation.swift */,
241256
4A14CBDA2803437C00DA8A68 /* ButtonClickStyleView.swift */,
242257
4A14CBCB2803437C00DA8A68 /* ButtonClickState.swift */,
243258
4A14CBCC2803437C00DA8A68 /* ButtonClick.swift */,
244259
4A14CBCD2803437C00DA8A68 /* ButtonClicClosure.swift */,
260+
4A14CBCF2803437C00DA8A68 /* Animations */,
261+
4A62F30C2803115C00534ABA /* UIDesignable */,
262+
4A14CBC42803437C00DA8A68 /* Style */,
245263
);
246264
path = ButtonClickStyle;
247265
sourceTree = "<group>";
248266
};
249267
4A14CBC42803437C00DA8A68 /* Style */ = {
250268
isa = PBXGroup;
251269
children = (
252-
4A14CBC52803437C00DA8A68 /* ButtonClickStyleShort.swift */,
253-
4A14CBC62803437C00DA8A68 /* ButtonClickStyle.swift */,
254-
4A231B79280A82250073284C /* ButtonClickStyleEmoji.swift */,
255-
4A14CBC72803437C00DA8A68 /* ButtonClickStyleBase.swift */,
256-
4A14CBC92803437C00DA8A68 /* ButtonClickStyleGestureRecognizer.swift */,
257270
);
258271
path = Style;
259272
sourceTree = "<group>";
260273
};
261274
4A14CBCF2803437C00DA8A68 /* Animations */ = {
262275
isa = PBXGroup;
263276
children = (
264-
4A14CBD02803437C00DA8A68 /* UIView+AnimationAlpha.swift */,
265-
4A14CBD12803437C00DA8A68 /* UIView+AnimationShadow.swift */,
266-
4A14CBD22803437C00DA8A68 /* UIView+AnimationPulsate.swift */,
267-
4A14CBD32803437C00DA8A68 /* UIView+AnimationAndroidPulse.swift */,
268-
4A14CBD42803437C00DA8A68 /* UIView+AnimationColor.swift */,
269-
4A14CBD52803437C00DA8A68 /* UIView+AnimationPulse.swift */,
270-
4A14CBD62803437C00DA8A68 /* UIView+AnimationColorFlat.swift */,
271-
4A14CBD72803437C00DA8A68 /* UIView+AnimationSnake.swift */,
272-
4A14CBD82803437C00DA8A68 /* UIView+AnimationFlash.swift */,
273-
4A14CBD92803437C00DA8A68 /* UIView+AnimationPress.swift */,
274-
4A85B5A22803D59800DFD435 /* UIView+AnimationGlare.swift */,
275277
);
276278
path = Animations;
277279
sourceTree = "<group>";
@@ -288,8 +290,6 @@
288290
4A62F30C2803115C00534ABA /* UIDesignable */ = {
289291
isa = PBXGroup;
290292
children = (
291-
4A62F30D2803115C00534ABA /* ButtonClickStyleDesignLabel.swift */,
292-
4A62F30E2803115C00534ABA /* ButtonClickStyleDesignView.swift */,
293293
);
294294
path = UIDesignable;
295295
sourceTree = "<group>";

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ extension ButtonClick {
7171

7272
4) Also you can select specific layers to animate / or just 1 specific one `allSubviews`
7373

74-
7574
5) Add animation duration `animationDuration`
7675

7776
6) Add animation value `animationTypeValue` - meaning means
@@ -133,7 +132,6 @@ extension ButtonClick {
133132

134133
![image](https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/ui3.gif)
135134

136-
137135
## License
138136

139137
ButtonClickStyle is released under the MIT license.

Source/ButtonClickStyle/ButtonClickState.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import UIKit
99

1010
extension ButtonClick {
1111

12-
struct State: Equatable {
12+
public struct State: Equatable {
1313
var titleText: String?
1414
var allSubviews: Bool = true
1515
var animationType: Int?
File renamed without changes.

Source/ButtonClickStyle/ButtonClickStyleAddViewsAnimation.swift

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ extension UIButton {
6868
click(for: .touchDown) { [weak self] in
6969
guard let self = self else { return }
7070
callback?(.touchDown)
71-
self.addClickStyleAnimation(with: views, radius: radius, style: style, event: .touchDown, duration: duration)
71+
self.addClickStyleAnimation(views: views, radius: radius, style: style, event: .touchDown, duration: duration)
7272
}
7373

7474
click(for: .touchUpInside) { [weak self] in
7575
guard let self = self else { return }
7676
callback?(.touchUpInside)
77-
self.addClickStyleAnimation(with: views, radius: radius, style: style, event: .touchUpInside, visible: true)
77+
self.addClickStyleAnimation(views: views, radius: radius, style: style, event: .touchUpInside, visible: true)
7878
}
7979
}
8080

@@ -96,7 +96,6 @@ extension UIButton {
9696
func randPointAndroidPulse() {
9797
let view = views[0]
9898

99-
10099
let position: CGPoint = .init(x: CGFloat.random(min: 0, max: view.frame.size.width), y: CGFloat.random(min: 0, max: view.frame.size.height))
101100
let dur = ButtonClick.Style.androidClickable(value, color: color).defaultDuration()
102101
buttonClickStyleAndroidPulse(radius: value, duration: dur, color: color, position: position)
@@ -116,9 +115,9 @@ extension UIButton {
116115

117116
default:
118117
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) { [weak self] in
119-
self?.addClickStyleAnimation(with: views, radius: radius, style: style, event: .touchDown, duration: duration)
118+
self?.addClickStyleAnimation(views: views, radius: radius, style: style, event: .touchDown, duration: duration)
120119
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.35) { [weak self] in
121-
self?.addClickStyleAnimation(with: views, radius: radius, style: style, event: .touchUpInside, duration: duration, visible: true)
120+
self?.addClickStyleAnimation(views: views, radius: radius, style: style, event: .touchUpInside, duration: duration, visible: true)
122121
}
123122
}
124123
}
@@ -131,7 +130,7 @@ extension UIButton {
131130
if (tag < 0) || (10 < tag) { return }
132131

133132
addClickStyleAnimation(
134-
with: views,
133+
views: views,
135134
style: ButtonClick.Style.allCases[tag-1],
136135
visible: true
137136
)
@@ -141,7 +140,7 @@ extension UIButton {
141140
// MARK: - Animation Filter
142141

143142
public func addClickStyleAnimation(
144-
with views: [UIView],
143+
views: [UIView],
145144
radius: CGFloat? = nil,
146145
style: ButtonClick.Style,
147146
event: UIControl.Event = .touchUpInside,
@@ -225,10 +224,6 @@ extension UIButton {
225224
$0.buttonClickStylePulsate(value: value, duration: dur)
226225
}
227226
}
228-
229-
// case .press(let power):
230-
// $0.press(duration: dur, value: power, visible: event != .touchDown)
231-
232227
case .shake(let value, let new):
233228
if new {
234229
$0.buttonClickStyleShake(value: value, duration: dur)
File renamed without changes.

Source/ButtonClickStyle/UIDesignable/ButtonClickStyleDesignLabel.swift renamed to Source/ButtonClickStyle/ButtonClickStyleDesignLabel.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,39 @@
22
import UIKit
33

44
@IBDesignable
5-
class ButtonClickStyleDesignLabel: UILabel {
5+
open class ButtonClickStyleDesignLabel: UILabel {
66

77
//MARK: Gradient
8-
@IBInspectable var grColor1: UIColor?
9-
@IBInspectable var grColor2: UIColor?
10-
@IBInspectable var grColor3: UIColor?
11-
@IBInspectable var grColor4: UIColor?
12-
@IBInspectable var grColor5: UIColor?
13-
@IBInspectable var grColor6: UIColor?
14-
15-
@IBInspectable var grStartPoint: CGPoint = .zero
16-
@IBInspectable var grEndPoint: CGPoint = .zero
17-
18-
@IBInspectable var grRadial: Bool = false
19-
@IBInspectable var grDrawsOptions: Bool = true
20-
@IBInspectable var grDebug: Bool = false
21-
@IBInspectable var grPointPercent: Bool = true
22-
@IBInspectable var grBlendMode: Int = 20
8+
@IBInspectable public var grColor1: UIColor?
9+
@IBInspectable public var grColor2: UIColor?
10+
@IBInspectable public var grColor3: UIColor?
11+
@IBInspectable public var grColor4: UIColor?
12+
@IBInspectable public var grColor5: UIColor?
13+
@IBInspectable public var grColor6: UIColor?
14+
15+
@IBInspectable public var grStartPoint: CGPoint = .zero
16+
@IBInspectable public var grEndPoint: CGPoint = .zero
17+
18+
@IBInspectable public var grRadial: Bool = false
19+
@IBInspectable public var grDrawsOptions: Bool = true
20+
@IBInspectable public var grDebug: Bool = false
21+
@IBInspectable public var grPointPercent: Bool = true
22+
@IBInspectable public var grBlendMode: Int = 20
2323

2424
//MARK: - Shadow
2525

26-
@IBInspectable var shColor: UIColor = .clear
27-
@IBInspectable var shRadius: CGFloat = 0.0
28-
@IBInspectable var shOffset: CGSize = .zero
26+
@IBInspectable public var shColor: UIColor = .clear
27+
@IBInspectable public var shRadius: CGFloat = 0.0
28+
@IBInspectable public var shOffset: CGSize = .zero
2929

3030
//MARK: Border
3131

32-
@IBInspectable var brColor: UIColor = .clear
33-
@IBInspectable var brWidth: CGFloat = 0.0
32+
@IBInspectable public var brColor: UIColor = .clear
33+
@IBInspectable public var brWidth: CGFloat = 0.0
3434

3535
//MARK: - Draw
3636

37-
override func draw(_ rect: CGRect) {
37+
open override func draw(_ rect: CGRect) {
3838
super.draw(rect)
3939
shadow()
4040
gradient()

Source/ButtonClickStyle/UIDesignable/ButtonClickStyleDesignView.swift renamed to Source/ButtonClickStyle/ButtonClickStyleDesignView.swift

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
11

22
import UIKit
33

4-
54
@IBDesignable
6-
class ButtonClickStyleDesignView: UIView {
5+
open class ButtonClickStyleDesignView: UIView {
76
/// Rectange | Ellipse | Polygon | Star
8-
@IBInspectable var figureType: Int = 0
9-
@IBInspectable var starRadius: CGFloat = 0
10-
@IBInspectable var starCount: Int = 5
11-
@IBInspectable var cornerRadius: CGFloat = 0.0
12-
@IBInspectable var blur: CGFloat = 0.0
13-
@IBInspectable var image: UIImage?
7+
@IBInspectable public var figureType: Int = 0
8+
@IBInspectable public var starRadius: CGFloat = 0
9+
@IBInspectable public var starCount: Int = 5
10+
@IBInspectable public var cornerRadius: CGFloat = 0.0
11+
@IBInspectable public var blur: CGFloat = 0.0
12+
@IBInspectable public var image: UIImage?
1413
/// ScaleToFill | Fit | Fill
15-
@IBInspectable var imageMode: Int = 1
16-
@IBInspectable var fillColor: UIColor?
17-
@IBInspectable var grColor1: UIColor?
18-
@IBInspectable var grColor2: UIColor?
19-
@IBInspectable var grColor3: UIColor?
20-
@IBInspectable var grColor4: UIColor?
21-
@IBInspectable var grColor5: UIColor?
22-
@IBInspectable var grColor6: UIColor?
23-
@IBInspectable var grStartPoint: CGPoint = .zero
24-
@IBInspectable var grEndPoint: CGPoint = .zero
14+
@IBInspectable public var imageMode: Int = 1
15+
@IBInspectable public var fillColor: UIColor?
16+
@IBInspectable public var grColor1: UIColor?
17+
@IBInspectable public var grColor2: UIColor?
18+
@IBInspectable public var grColor3: UIColor?
19+
@IBInspectable public var grColor4: UIColor?
20+
@IBInspectable public var grColor5: UIColor?
21+
@IBInspectable public var grColor6: UIColor?
22+
@IBInspectable public var grStartPoint: CGPoint = .zero
23+
@IBInspectable public var grEndPoint: CGPoint = .zero
2524
/// Default: Linear
26-
@IBInspectable var grRadial: Bool = false
27-
@IBInspectable var grDrawsOptions: Bool = true
28-
@IBInspectable var grDebug: Bool = false
29-
@IBInspectable var grPointPercent: Bool = true
30-
@IBInspectable var grBlendMode: Int = 0
31-
@IBInspectable var brColor: UIColor = .clear
32-
@IBInspectable var brWidth: CGFloat = 0.0
33-
@IBInspectable var brDash: Int = 0
34-
@IBInspectable var inShColor: UIColor = .clear
35-
@IBInspectable var inShRadius: CGFloat = 0.0
36-
@IBInspectable var inShOffset: CGSize = .zero
37-
@IBInspectable var shColor: UIColor = .clear
38-
@IBInspectable var shRadius: CGFloat = 0.0
39-
@IBInspectable var shOffset: CGSize = .zero
40-
41-
func allColorClear() {
25+
@IBInspectable public var grRadial: Bool = false
26+
@IBInspectable public var grDrawsOptions: Bool = true
27+
@IBInspectable public var grDebug: Bool = false
28+
@IBInspectable public var grPointPercent: Bool = true
29+
@IBInspectable public var grBlendMode: Int = 0
30+
@IBInspectable public var brColor: UIColor = .clear
31+
@IBInspectable public var brWidth: CGFloat = 0.0
32+
@IBInspectable public var brDash: Int = 0
33+
@IBInspectable public var inShColor: UIColor = .clear
34+
@IBInspectable public var inShRadius: CGFloat = 0.0
35+
@IBInspectable public var inShOffset: CGSize = .zero
36+
@IBInspectable public var shColor: UIColor = .clear
37+
@IBInspectable public var shRadius: CGFloat = 0.0
38+
@IBInspectable public var shOffset: CGSize = .zero
39+
40+
public func allColorClear() {
4241
fillColor = .clear
4342
brColor = .clear
4443
shColor = .clear
@@ -52,7 +51,7 @@ class ButtonClickStyleDesignView: UIView {
5251
setNeedsLayout()
5352
}
5453

55-
func setup() {
54+
public func setup() {
5655

5756
if let foundView = viewWithTag(55) {
5857
foundView.removeFromSuperview()
@@ -117,16 +116,16 @@ class ButtonClickStyleDesignView: UIView {
117116
// fatalError("init(coder:) has not been implemented")
118117
// }
119118

120-
func createCopy() -> ButtonClickStyleDesignView {
119+
public func createCopy() -> ButtonClickStyleDesignView {
121120
ButtonClickStyleDesignView()
122121
}
123122

124-
override func layoutSubviews() { setup() }
123+
open override func layoutSubviews() { setup() }
125124

126125
}
127126

128127
extension ButtonClickStyleDesignView: NSCopying {
129-
func copy(with zone: NSZone? = nil) -> Any
128+
public func copy(with zone: NSZone? = nil) -> Any
130129
{
131130
let d = ButtonClickStyleDesignView()
132131
d.frame = self.frame

Source/ButtonClickStyle/Style/ButtonClickStyleEmoji.swift renamed to Source/ButtonClickStyle/ButtonClickStyleEmoji.swift

File renamed without changes.

0 commit comments

Comments
 (0)