Skip to content

Commit 78ac697

Browse files
author
Luc Dion
authored
Merge pull request #12 from mirego/update
Multi changes
2 parents 1e28294 + 418d80d commit 78ac697

File tree

16 files changed

+311
-220
lines changed

16 files changed

+311
-220
lines changed

Keynote Layout presentation.key

-11.1 KB
Binary file not shown.

MCSwiftLayout/Extensions/UIView+PinLayout.swift

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ public extension UIView {
1717
return PinList(view: self)
1818
}
1919

20+
// public var pin: Layout {
21+
// return Layout(view: self)
22+
// }
23+
2024
public var edge: EdgeList {
2125
return EdgeList(view: self)
2226
}
@@ -26,26 +30,26 @@ public extension UIView {
2630
// }
2731
}
2832

29-
// Could be part of another GitHub repo
30-
//public extension UIView {
31-
/*public var top: CGFloat {
33+
// Could be part of another GitHub repo?
34+
public extension UIView {
35+
public var top: CGFloat {
3236
get { return frame.origin.y }
33-
set { frame = CGRect(x: left, y: roundFloatToDisplayScale(newValue), width: width, height: height) }
37+
set { frame = CGRect(x: left, y: Coordinates.roundFloatToDisplayScale(newValue), width: width, height: height) }
3438
}
3539

3640
public var left: CGFloat {
3741
get { return frame.origin.x }
38-
set { frame = CGRect(x: roundFloatToDisplayScale(newValue), y: top, width: width, height: height) }
42+
set { frame = CGRect(x: Coordinates.roundFloatToDisplayScale(newValue), y: top, width: width, height: height) }
3943
}
4044

4145
public var bottom: CGFloat {
4246
get { return frame.maxY }
43-
set { height = roundFloatToDisplayScale(newValue - top) }
47+
set { height = Coordinates.roundFloatToDisplayScale(newValue - top) }
4448
}
4549

4650
public var right: CGFloat {
4751
get { return frame.maxX }
48-
set { width = roundFloatToDisplayScale(newValue - left) }
52+
set { width = Coordinates.roundFloatToDisplayScale(newValue - left) }
4953
}
5054

5155
public var hCenter: CGFloat {
@@ -56,7 +60,7 @@ public extension UIView {
5660
public var vCenter: CGFloat {
5761
get { return top + (height / 2) }
5862
set { top = newValue - (height / 2) }
59-
}*/
63+
}
6064

6165
/* public var topLeft: CGPoint {
6266
get { return CGPoint(x: left, y: top) }
@@ -130,18 +134,22 @@ public extension UIView {
130134
}
131135
} */
132136

133-
// public var size: CGSize {
134-
// get { return CGSize(width: width, height: height) }
135-
// set { frame = CGRect(x: left, y: top, width: ceilFloatToDisplayScale(newValue.width), height: ceilFloatToDisplayScale(newValue.height)) }
136-
// }
137-
//
138-
// public var width: CGFloat {
139-
// get { return frame.size.width }
140-
// set { frame = CGRect(x: left, y: top, width: ceilFloatToDisplayScale(newValue), height: height) }
141-
// }
142-
//
143-
// public var height: CGFloat {
144-
// get { return frame.size.height }
145-
// set { frame = CGRect(x: left, y: top, width: width, height: ceilFloatToDisplayScale(newValue)) }
146-
// }
147-
//}
137+
public var size: CGSize {
138+
get { return CGSize(width: frame.size.width, height: frame.size.height) }
139+
set { frame = CGRect(x: frame.origin.x, y: frame.origin.y,
140+
width: Coordinates.ceilFloatToDisplayScale(newValue.width),
141+
height: Coordinates.ceilFloatToDisplayScale(newValue.height)) }
142+
}
143+
144+
public var width: CGFloat {
145+
get { return frame.size.width }
146+
set { frame = CGRect(x: frame.origin.x, y: frame.origin.y,
147+
width: Coordinates.ceilFloatToDisplayScale(newValue), height: height) }
148+
}
149+
150+
public var height: CGFloat {
151+
get { return frame.size.height }
152+
set { frame = CGRect(x: frame.origin.x, y: frame.origin.y,
153+
width: width, height: Coordinates.ceilFloatToDisplayScale(newValue)) }
154+
}
155+
}

0 commit comments

Comments
 (0)