Skip to content

Commit 9222247

Browse files
add state style init
1 parent 4285acc commit 9222247

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let package = Package(
77
name: "ButtonClickStyle",
88
platforms: [
99
// Add support for all platforms starting from a specific version.
10-
.iOS(.v14),
10+
.iOS(.v9),
1111
],
1212
products: [
1313
// Products define the executables and libraries a package produces, and make them visible to other packages.

Sources/ButtonClickStyle/ButtonClickStyleView.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,22 @@ open class ButtonClickStyleView: UIView {
4949

5050
super.init(frame: frame)
5151

52+
var type: Int = state.animationType ?? self.animType
53+
if let style = state.animationStyle {
54+
type = style.rawValue
55+
}
56+
5257
var state = state
53-
if state.animationType == ButtonClick._Style.colorFlat.rawValue ||
54-
state.animationType == ButtonClick._Style.color.rawValue {
58+
if type == ButtonClick._Style.colorFlat.rawValue ||
59+
type == ButtonClick._Style.color.rawValue {
5560
state.allSubviews = false
5661
}
5762

5863
self.state = state
5964
self.cornerRadius = radius
6065
self.layer.cornerRadius = radius
6166
self.allSubviews = state.allSubviews
62-
self.animType = state.animationType ?? 0
67+
self.animType = type
6368
self.addViews = addViews
6469
self.debugButtonShow = state.debugButtonShow
6570

0 commit comments

Comments
 (0)