Skip to content

Commit ccd7599

Browse files
committed
Merge branch 'main' into origin
2 parents 9c39d84 + d072f9b commit ccd7599

File tree

4 files changed

+72
-72
lines changed

4 files changed

+72
-72
lines changed

Example/ButtonClickStyle/UI/Screen/ExampleAnimations/ExampleAnimationsViewController.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ class ExampleAnimationsViewController: StoryboardController {
198198
label.font = UIFont.boldSystemFont(ofSize: 19)
199199
label.frame = getFrame()
200200
label.text = buttonTypes[animationType].name
201-
label.x = label.x + 250
202-
label.y = label.y - 12
203-
label.width = label.width + 100
201+
label.xx = label.xx + 250
202+
label.yy = label.yy - 12
203+
label.wwidth = label.wwidth + 100
204204
self.view.addSubview(label)
205205
labelsAdded.append(label)
206206

@@ -216,9 +216,9 @@ class ExampleAnimationsViewController: StoryboardController {
216216
label.textAlignment = .center
217217
label.frame = getFrame()
218218
label.text = buttonTypes[animationType].base // //.isEmpty ? "" : "☑️"
219-
label.x = xX
220-
label.width = xW + 30
221-
label.y = label.y - 12
219+
label.xx = xX
220+
label.wwidth = xW + 30
221+
label.yy = label.yy - 12
222222
label.alpha = 0.0
223223
label.backgroundColor = .black.withAlphaComponent(xC)
224224
self.view.addSubview(label)
@@ -231,11 +231,11 @@ class ExampleAnimationsViewController: StoryboardController {
231231
label.textAlignment = .center
232232
label.frame = getFrame()
233233
label.text = buttonTypes[animationType].emoji.color //.isEmpty ? "" : "☑️"
234-
label.x = xX
235-
label.width = xW
234+
label.xx = xX
235+
label.wwidth = xW
236236
label.alpha = xA / xD
237237
label.backgroundColor = .black.withAlphaComponent(xC * xD)
238-
label.y = label.y - 12
238+
label.yy = label.yy - 12
239239
self.view.addSubview(label)
240240
labelsAdded.append(label)
241241
xX = label.right + xP
@@ -245,9 +245,9 @@ class ExampleAnimationsViewController: StoryboardController {
245245
label.textAlignment = .center
246246
label.frame = getFrame()
247247
label.text = buttonTypes[animationType].emoji.repeats.isEmpty ? "" : "☑️"
248-
label.x = xX
249-
label.width = xW
250-
label.y = label.y - 12
248+
label.xx = xX
249+
label.wwidth = xW
250+
label.yy = label.yy - 12
251251
label.alpha = xA
252252
label.backgroundColor = .black.withAlphaComponent(xC)
253253
self.view.addSubview(label)
@@ -259,9 +259,9 @@ class ExampleAnimationsViewController: StoryboardController {
259259
label.textAlignment = .center
260260
label.frame = getFrame()
261261
label.text = buttonTypes[animationType].emoji.new //.isEmpty ? "" : "☑️"
262-
label.x = xX
263-
label.width = xW
264-
label.y = label.y - 12
262+
label.xx = xX
263+
label.wwidth = xW
264+
label.yy = label.yy - 12
265265
label.alpha = xA
266266
label.backgroundColor = .black.withAlphaComponent(xC)
267267
self.view.addSubview(label)

Source/ButtonClickStyle/Animations/UIView+AnimationShadow.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ extension UIView {
6868

6969
shadowContentView.addSubview(imgBtn)
7070
}
71-
shadowView.width = wMax
72-
shadowView.height = hMax
71+
shadowView.wwidth = wMax
72+
shadowView.hheight = hMax
7373

7474
mainView.addSubview(shadowView)
7575

Source/ButtonClickStyle/ButtonClickStyleAddViewsAnimation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ extension UIButton {
108108

109109
func randPointAndroidPulse() {
110110
let view = views[0]
111-
let position: CGPoint = .init(x: CGFloat.random(min: 0, max: view.width), y: CGFloat.random(min: 0, max: view.height))
111+
let position: CGPoint = .init(x: CGFloat.random(min: 0, max: view.wwidth), y: CGFloat.random(min: 0, max: view.hheight))
112112
let dur = ButtonClick.Style.androidClickable(value, color: color).defaultDuration()
113113
buttonClickStyleAndroidPulse(radius: value, duration: dur, color: color, position: position)
114114
}

Source/ButtonClickStyle/Utils/UIView+Positions.swift

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ import UIKit
44
//MARK: - Round
55
extension UIView {
66

7-
func set(x:CGFloat) {
7+
public func set(x:CGFloat) {
88
var frame:CGRect = self.frame
99
frame.origin.x = x
1010
self.frame = frame
1111
}
1212

13-
func set(y:CGFloat) {
13+
public func set(y:CGFloat) {
1414
var frame:CGRect = self.frame
1515
frame.origin.y = y
1616
self.frame = frame
1717
}
1818

19-
func set(width:CGFloat) {
19+
public func set(width:CGFloat) {
2020
var frame:CGRect = self.frame
2121
frame.size.width = width
2222
self.frame = frame
2323
}
2424

25-
func set(height:CGFloat) {
25+
public func set(height:CGFloat) {
2626
var frame:CGRect = self.frame
2727
frame.size.height = height
2828
self.frame = frame
@@ -31,70 +31,70 @@ extension UIView {
3131

3232
extension CALayer {
3333

34-
func set(x:CGFloat) {
34+
public func set(x:CGFloat) {
3535
var frame:CGRect = self.frame
3636
frame.origin.x = x
3737
self.frame = frame
3838
}
3939

40-
func set(y:CGFloat) {
40+
public func set(y:CGFloat) {
4141
var frame:CGRect = self.frame
4242
frame.origin.y = y
4343
self.frame = frame
4444
}
4545

46-
func set(width:CGFloat) {
46+
public func set(width:CGFloat) {
4747
var frame:CGRect = self.frame
4848
frame.size.width = width
4949
self.frame = frame
5050
}
5151

52-
func set(height:CGFloat) {
52+
public func set(height:CGFloat) {
5353
var frame:CGRect = self.frame
5454
frame.size.height = height
5555
self.frame = frame
5656
}
5757
}
5858

59-
public extension UIView {
59+
extension UIView {
6060

6161
// MARK: - Basic Properties
6262

6363
/// X Axis value of UIView.
64-
var x: CGFloat {
64+
public var xx: CGFloat {
6565
set { self.frame = CGRect(x: _pixelIntegral(newValue),
66-
y: self.y,
67-
width: self.width,
68-
height: self.height)
66+
y: self.yy,
67+
width: self.wwidth,
68+
height: self.hheight)
6969
}
7070
get { return self.frame.origin.x }
7171
}
7272

7373
/// Y Axis value of UIView.
74-
var y: CGFloat {
75-
set { self.frame = CGRect(x: self.x,
74+
public var yy: CGFloat {
75+
set { self.frame = CGRect(x: self.xx,
7676
y: _pixelIntegral(newValue),
77-
width: self.width,
78-
height: self.height)
77+
width: self.wwidth,
78+
height: self.hheight)
7979
}
8080
get { return self.frame.origin.y }
8181
}
8282

8383
/// Width of view.
84-
var width: CGFloat {
85-
set { self.frame = CGRect(x: self.x,
86-
y: self.y,
84+
public var wwidth: CGFloat {
85+
set { self.frame = CGRect(x: self.xx,
86+
y: self.yy,
8787
width: _pixelIntegral(newValue),
88-
height: self.height)
88+
height: self.hheight)
8989
}
9090
get { return self.frame.size.width }
9191
}
9292

9393
/// Height of view.
94-
var height: CGFloat {
95-
set { self.frame = CGRect(x: self.x,
96-
y: self.y,
97-
width: self.width,
94+
public var hheight: CGFloat {
95+
set { self.frame = CGRect(x: self.xx,
96+
y: self.yy,
97+
width: self.wwidth,
9898
height: _pixelIntegral(newValue))
9999
}
100100
get { return self.frame.size.height }
@@ -103,19 +103,19 @@ public extension UIView {
103103
// MARK: - Origin and Size
104104

105105
/// View's Origin point.
106-
var origin: CGPoint {
106+
public var origin: CGPoint {
107107
set { self.frame = CGRect(x: _pixelIntegral(newValue.x),
108108
y: _pixelIntegral(newValue.y),
109-
width: self.width,
110-
height: self.height)
109+
width: self.wwidth,
110+
height: self.hheight)
111111
}
112112
get { return self.frame.origin }
113113
}
114114

115115
/// View's size.
116-
var size: CGSize {
117-
set { self.frame = CGRect(x: self.x,
118-
y: self.y,
116+
public var size: CGSize {
117+
set { self.frame = CGRect(x: self.xx,
118+
y: self.yy,
119119
width: _pixelIntegral(newValue.width),
120120
height: _pixelIntegral(newValue.height))
121121
}
@@ -125,59 +125,59 @@ public extension UIView {
125125
// MARK: - Extra Properties
126126

127127
/// View's right side (x + width).
128-
var right: CGFloat {
129-
set { self.x = newValue - self.width }
130-
get { return self.x + self.width }
128+
public var right: CGFloat {
129+
set { self.xx = newValue - self.wwidth }
130+
get { return self.xx + self.wwidth }
131131
}
132132

133133
/// View's bottom (y + height).
134-
var bottom: CGFloat {
135-
set { self.y = newValue - self.height }
136-
get { return self.y + self.height }
134+
public var bottom: CGFloat {
135+
set { self.yy = newValue - self.hheight }
136+
get { return self.yy + self.hheight }
137137
}
138138

139139
/// View's top (y).
140-
var top: CGFloat {
141-
set { self.y = newValue }
142-
get { return self.y }
140+
public var top: CGFloat {
141+
set { self.yy = newValue }
142+
get { return self.yy }
143143
}
144144

145145
/// View's left side (x).
146-
var left: CGFloat {
147-
set { self.x = newValue }
148-
get { return self.x }
146+
public var left: CGFloat {
147+
set { self.xx = newValue }
148+
get { return self.xx }
149149
}
150150

151151
/// View's center X value (center.x).
152-
var centerX: CGFloat {
152+
public var centerX: CGFloat {
153153
set { self.center = CGPoint(x: newValue, y: self.centerY) }
154154
get { return self.center.x }
155155
}
156156

157157
/// View's center Y value (center.y).
158-
var centerY: CGFloat {
158+
public var centerY: CGFloat {
159159
set { self.center = CGPoint(x: self.centerX, y: newValue) }
160160
get { return self.center.y }
161161
}
162162

163163
/// Last subview on X Axis.
164-
var lastSubviewOnX: UIView? {
164+
public var lastSubviewOnX: UIView? {
165165
return self.subviews.reduce(UIView(frame: .zero)) {
166-
return $1.x > $0.x ? $1 : $0
166+
return $1.xx > $0.xx ? $1 : $0
167167
}
168168
}
169169

170170
/// Last subview on Y Axis.
171-
var lastSubviewOnY: UIView? {
171+
public var lastSubviewOnY: UIView? {
172172
return self.subviews.reduce(UIView(frame: .zero)) {
173-
return $1.y > $0.y ? $1 : $0
173+
return $1.yy > $0.yy ? $1 : $0
174174
}
175175
}
176176

177177
// MARK: - Bounds Methods
178178

179179
/// X value of bounds (bounds.origin.x).
180-
var boundsX: CGFloat {
180+
public var boundsX: CGFloat {
181181
set { self.bounds = CGRect(x: _pixelIntegral(newValue),
182182
y: self.boundsY,
183183
width: self.boundsWidth,
@@ -187,7 +187,7 @@ public extension UIView {
187187
}
188188

189189
/// Y value of bounds (bounds.origin.y).
190-
var boundsY: CGFloat {
190+
public var boundsY: CGFloat {
191191
set { self.frame = CGRect(x: self.boundsX,
192192
y: _pixelIntegral(newValue),
193193
width: self.boundsWidth,
@@ -197,7 +197,7 @@ public extension UIView {
197197
}
198198

199199
/// Width of bounds (bounds.size.width).
200-
var boundsWidth: CGFloat {
200+
public var boundsWidth: CGFloat {
201201
set { self.frame = CGRect(x: self.boundsX,
202202
y: self.boundsY,
203203
width: _pixelIntegral(newValue),
@@ -207,7 +207,7 @@ public extension UIView {
207207
}
208208

209209
/// Height of bounds (bounds.size.height).
210-
var boundsHeight: CGFloat {
210+
public var boundsHeight: CGFloat {
211211
set { self.frame = CGRect(x: self.boundsX,
212212
y: self.boundsY,
213213
width: self.boundsWidth,
@@ -217,7 +217,7 @@ public extension UIView {
217217
}
218218

219219
// MARK: - Private Methods
220-
fileprivate func _pixelIntegral(_ pointValue: CGFloat) -> CGFloat {
220+
fileprivate func _pixelIntegral(_ pointValue: CGFloat) -> CGFloat {
221221
let scale = UIScreen.main.scale
222222
return (round(pointValue * scale) / scale)
223223
}

0 commit comments

Comments
 (0)