Skip to content

Commit 083e9b9

Browse files
author
Luc Dion
committed
All frame and bounds now use UIView.getRect()/UIView.setRect()
1 parent 53376df commit 083e9b9

13 files changed

+137
-115
lines changed

PinLayout.xcodeproj/project.pbxproj

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
240F88BE1F0C066800280FC8 /* JustifyAlignSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 240F88BC1F0C042500280FC8 /* JustifyAlignSpec.swift */; };
1313
240F88C11F0C1F5000280FC8 /* WarningSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 240F88BF1F0C1ED900280FC8 /* WarningSpec.swift */; };
1414
241A277D1F8E958F00B1AD39 /* PinLayoutObjC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 241A277B1F8E958F00B1AD39 /* PinLayoutObjC.swift */; };
15-
241A277E1F8E958F00B1AD39 /* PinLayoutObjCImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 241A277C1F8E958F00B1AD39 /* PinLayoutObjCImpl.swift */; };
1615
242723731F008BF7006A5C3A /* MinMaxWidthHeightSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 242723711F008B85006A5C3A /* MinMaxWidthHeightSpec.swift */; };
1716
242E8DC31EED5AB2005935FB /* RelativePositionMultipleViewsSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 242E8DC11EED5982005935FB /* RelativePositionMultipleViewsSpec.swift */; };
1817
243B12BC1FC393580072A9C3 /* Percent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 243C620E1FC3834B0082C327 /* Percent.swift */; };
@@ -24,7 +23,7 @@
2423
243C62081FC37F6C0082C327 /* PinLayoutImpl+Warning.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6C81FC37C1C0054CADD /* PinLayoutImpl+Warning.swift */; };
2524
243C62091FC37F6C0082C327 /* Coordinates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6D21FC37CD40054CADD /* Coordinates.swift */; };
2625
243C620A1FC37F6C0082C327 /* TypesImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6CE1FC37C570054CADD /* TypesImpl.swift */; };
27-
243C620B1FC37F6C0082C327 /* UIView+LTR.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6D01FC37C8C0054CADD /* UIView+LTR.swift */; };
26+
243C620B1FC37F6C0082C327 /* View+LTR.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6D01FC37C8C0054CADD /* View+LTR.swift */; };
2827
243C620C1FC37FA30082C327 /* PinLayoutTVOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 2475B6D71FC37D4D0054CADD /* PinLayoutTVOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
2928
243C620F1FC3834B0082C327 /* Percent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 243C620E1FC3834B0082C327 /* Percent.swift */; };
3029
244C6E151E776A0C0074FC74 /* MarginsSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 244C6E141E776A0C0074FC74 /* MarginsSpec.swift */; };
@@ -40,7 +39,7 @@
4039
2475B6CC1FC37C1C0054CADD /* PinLayoutImpl+Warning.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6C81FC37C1C0054CADD /* PinLayoutImpl+Warning.swift */; };
4140
2475B6CD1FC37C1C0054CADD /* PinLayoutImpl+Relative.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6C91FC37C1C0054CADD /* PinLayoutImpl+Relative.swift */; };
4241
2475B6CF1FC37C570054CADD /* TypesImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6CE1FC37C570054CADD /* TypesImpl.swift */; };
43-
2475B6D11FC37C8C0054CADD /* UIView+LTR.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6D01FC37C8C0054CADD /* UIView+LTR.swift */; };
42+
2475B6D11FC37C8C0054CADD /* View+LTR.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6D01FC37C8C0054CADD /* View+LTR.swift */; };
4443
2475B6D31FC37CD40054CADD /* Coordinates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6D21FC37CD40054CADD /* Coordinates.swift */; };
4544
2475B6DB1FC37D4D0054CADD /* PinLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 2475B6D91FC37D4D0054CADD /* PinLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
4645
2482908C1E78CFFC00667D08 /* RelativePositionSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2482908B1E78CFFC00667D08 /* RelativePositionSpec.swift */; };
@@ -73,13 +72,16 @@
7372
DF1A5D412084CFD600725EF5 /* Coordinates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6D21FC37CD40054CADD /* Coordinates.swift */; };
7473
DF1A5D422084CFD600725EF5 /* Percent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 243C620E1FC3834B0082C327 /* Percent.swift */; };
7574
DF1A5D432084CFD600725EF5 /* TypesImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6CE1FC37C570054CADD /* TypesImpl.swift */; };
76-
DF1A5D442084CFD600725EF5 /* UIView+LTR.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6D01FC37C8C0054CADD /* UIView+LTR.swift */; };
75+
DF1A5D442084CFD600725EF5 /* View+LTR.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2475B6D01FC37C8C0054CADD /* View+LTR.swift */; };
7776
DF1E39B520482B200002D0AA /* PinSafeAreaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF1E39B420482B1F0002D0AA /* PinSafeAreaTests.swift */; };
7877
DF28022420C2B13800A1833B /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFF222CC20B999BD00AC2A84 /* Types.swift */; };
7978
DF28022520C2B13900A1833B /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFF222CC20B999BD00AC2A84 /* Types.swift */; };
8079
DF28022620C2B15A00A1833B /* Types+Description.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFF222CE20B99A6600AC2A84 /* Types+Description.swift */; };
8180
DF28022720C2B15B00A1833B /* Types+Description.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFF222CE20B99A6600AC2A84 /* Types+Description.swift */; };
8281
DF7A36BD1E918301000F9856 /* PinEdgesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF7A36BC1E918301000F9856 /* PinEdgesSpec.swift */; };
82+
DF96F30920CB5DB7007CA714 /* View+Rect.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF96F30820CB5DB7007CA714 /* View+Rect.swift */; };
83+
DF96F30A20CB5DDC007CA714 /* View+Rect.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF96F30820CB5DB7007CA714 /* View+Rect.swift */; };
84+
DF96F30B20CB5DDD007CA714 /* View+Rect.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF96F30820CB5DB7007CA714 /* View+Rect.swift */; };
8385
DFABC01F208781A900CB6494 /* Types+Appkit.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFABC01E208781A900CB6494 /* Types+Appkit.swift */; };
8486
DFABC022208781ED00CB6494 /* Types+UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFABC020208781C700CB6494 /* Types+UIKit.swift */; };
8587
DFABC023208781EE00CB6494 /* Types+UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFABC020208781C700CB6494 /* Types+UIKit.swift */; };
@@ -194,7 +196,7 @@
194196
2475B6C81FC37C1C0054CADD /* PinLayoutImpl+Warning.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "PinLayoutImpl+Warning.swift"; path = "Impl/PinLayoutImpl+Warning.swift"; sourceTree = "<group>"; };
195197
2475B6C91FC37C1C0054CADD /* PinLayoutImpl+Relative.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "PinLayoutImpl+Relative.swift"; path = "Impl/PinLayoutImpl+Relative.swift"; sourceTree = "<group>"; };
196198
2475B6CE1FC37C570054CADD /* TypesImpl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TypesImpl.swift; path = Impl/TypesImpl.swift; sourceTree = "<group>"; };
197-
2475B6D01FC37C8C0054CADD /* UIView+LTR.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIView+LTR.swift"; path = "Impl/UIView+LTR.swift"; sourceTree = "<group>"; };
199+
2475B6D01FC37C8C0054CADD /* View+LTR.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "View+LTR.swift"; path = "Impl/View+LTR.swift"; sourceTree = "<group>"; };
198200
2475B6D21FC37CD40054CADD /* Coordinates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Coordinates.swift; path = Impl/Coordinates.swift; sourceTree = "<group>"; };
199201
2475B6D61FC37D4D0054CADD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
200202
2475B6D71FC37D4D0054CADD /* PinLayoutTVOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PinLayoutTVOS.h; sourceTree = "<group>"; };
@@ -225,6 +227,7 @@
225227
DF1A5D2E2084CF9700725EF5 /* PinLayoutMacOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PinLayoutMacOS.h; sourceTree = "<group>"; };
226228
DF1E39B420482B1F0002D0AA /* PinSafeAreaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinSafeAreaTests.swift; sourceTree = "<group>"; };
227229
DF7A36BC1E918301000F9856 /* PinEdgesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinEdgesSpec.swift; sourceTree = "<group>"; };
230+
DF96F30820CB5DB7007CA714 /* View+Rect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Rect.swift"; sourceTree = "<group>"; };
228231
DFABC01E208781A900CB6494 /* Types+Appkit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Types+Appkit.swift"; sourceTree = "<group>"; };
229232
DFABC020208781C700CB6494 /* Types+UIKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Types+UIKit.swift"; sourceTree = "<group>"; };
230233
DFB3ECB02061602E005F226B /* PinSafeArea.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PinSafeArea.swift; path = Impl/PinSafeArea.swift; sourceTree = "<group>"; };
@@ -410,7 +413,8 @@
410413
243C620E1FC3834B0082C327 /* Percent.swift */,
411414
2475B6CE1FC37C570054CADD /* TypesImpl.swift */,
412415
DFF222CE20B99A6600AC2A84 /* Types+Description.swift */,
413-
2475B6D01FC37C8C0054CADD /* UIView+LTR.swift */,
416+
2475B6D01FC37C8C0054CADD /* View+LTR.swift */,
417+
DF96F30820CB5DB7007CA714 /* View+Rect.swift */,
414418
);
415419
name = Impl;
416420
sourceTree = "<group>";
@@ -828,11 +832,12 @@
828832
DFF222CB20B9994300AC2A84 /* PinLayoutImpl+WrapContent.swift in Sources */,
829833
243B12BC1FC393580072A9C3 /* Percent.swift in Sources */,
830834
DFB3ECB72062A937005F226B /* PinSafeArea.swift in Sources */,
835+
DF96F30B20CB5DDD007CA714 /* View+Rect.swift in Sources */,
831836
DFEAF75420C9667D00E33147 /* PinLayoutImpl+Size.swift in Sources */,
832837
DF1A5D0420812DE100725EF5 /* UIView+PinLayout.swift in Sources */,
833838
24B02B091F2A713000C18179 /* Filters.swift in Sources */,
834839
24B02B0A1F2A713300C18179 /* PinLayout.swift in Sources */,
835-
243C620B1FC37F6C0082C327 /* UIView+LTR.swift in Sources */,
840+
243C620B1FC37F6C0082C327 /* View+LTR.swift in Sources */,
836841
243C62091FC37F6C0082C327 /* Coordinates.swift in Sources */,
837842
243C620A1FC37F6C0082C327 /* TypesImpl.swift in Sources */,
838843
243C62061FC37F6C0082C327 /* PinLayoutImpl+Layouting.swift in Sources */,
@@ -847,15 +852,15 @@
847852
24D18D241F3E37DD008129EF /* Pin.swift in Sources */,
848853
2475B6CA1FC37C1C0054CADD /* PinLayoutImpl.swift in Sources */,
849854
DFF222CF20B99A6600AC2A84 /* Types+Description.swift in Sources */,
850-
241A277E1F8E958F00B1AD39 /* PinLayoutObjCImpl.swift in Sources */,
851855
DF1A5D372084CFC200725EF5 /* NSView+PinLayout.swift in Sources */,
852856
DFF222CD20B999BD00AC2A84 /* Types.swift in Sources */,
853857
243C620F1FC3834B0082C327 /* Percent.swift in Sources */,
854858
2475B6CB1FC37C1C0054CADD /* PinLayoutImpl+Coordinates.swift in Sources */,
855859
2475B6C51FC37A900054CADD /* PinLayoutImpl+Layouting.swift in Sources */,
856860
DFF222C920B997A500AC2A84 /* PinLayoutImpl+WrapContent.swift in Sources */,
857861
2475B6CF1FC37C570054CADD /* TypesImpl.swift in Sources */,
858-
2475B6D11FC37C8C0054CADD /* UIView+LTR.swift in Sources */,
862+
2475B6D11FC37C8C0054CADD /* View+LTR.swift in Sources */,
863+
DF96F30920CB5DB7007CA714 /* View+Rect.swift in Sources */,
859864
DFEAF71220C8081800E33147 /* PinLayoutImpl+Size.swift in Sources */,
860865
DFC97CA71E8A8F2C001545D5 /* PinLayout.swift in Sources */,
861866
2475B6CC1FC37C1C0054CADD /* PinLayoutImpl+Warning.swift in Sources */,
@@ -936,8 +941,9 @@
936941
DF1A5D422084CFD600725EF5 /* Percent.swift in Sources */,
937942
DF1A5D3E2084CFD600725EF5 /* PinLayoutImpl+Relative.swift in Sources */,
938943
DFF222CA20B9994200AC2A84 /* PinLayoutImpl+WrapContent.swift in Sources */,
939-
DF1A5D442084CFD600725EF5 /* UIView+LTR.swift in Sources */,
944+
DF1A5D442084CFD600725EF5 /* View+LTR.swift in Sources */,
940945
DF1A5D352084CFC100725EF5 /* NSView+PinLayout.swift in Sources */,
946+
DF96F30A20CB5DDC007CA714 /* View+Rect.swift in Sources */,
941947
DFEAF75320C9667C00E33147 /* PinLayoutImpl+Size.swift in Sources */,
942948
DF1A5D3A2084CFC600725EF5 /* UIView+PinLayout.swift in Sources */,
943949
DFED155120853085009EF9A7 /* PinLayout.swift in Sources */,

Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ EXTERNAL SOURCES:
2525

2626
SPEC CHECKSUMS:
2727
Nimble: 7f5a9c447a33002645a071bddafbfb24ea70e0ac
28-
PinLayout: 4642450cec04378f3ce3b7164c4b2c5016b36f91
28+
PinLayout: 9bfd33d7af1ff416ac73af8971cfd128a98560ae
2929
Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08
3030
Reveal-SDK: 7869ddf1f902cabbb07a1f0dd06bd25861a126f7
3131
SwiftLint: ce933681be10c3266e82576dad676fa815a602e9

Sources/Impl/Coordinates.swift

Lines changed: 11 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919

2020
import Foundation
2121

22-
#if os(iOS) || os(tvOS)
23-
import UIKit
24-
#else
25-
import AppKit
26-
#endif
27-
2822
public func _pinlayoutSetUnitTest(displayScale: CGFloat) {
2923
Coordinates.displayScale = displayScale
3024
}
@@ -38,57 +32,57 @@ final class Coordinates {
3832
internal static var onePixelLength: CGFloat = 1 / displayScale
3933

4034
static func hCenter(_ view: PView, keepTransform: Bool) -> CGFloat {
41-
let rect = getViewRect(view, keepTransform: keepTransform)
35+
let rect = view.getRect(keepTransform: keepTransform)
4236
return rect.minX + (rect.width / 2)
4337
}
4438

4539
static func vCenter(_ view: PView, keepTransform: Bool) -> CGFloat {
46-
let rect = getViewRect(view, keepTransform: keepTransform)
40+
let rect = view.getRect(keepTransform: keepTransform)
4741
return rect.minY + (rect.height / 2)
4842
}
4943

5044
static func topLeft(_ view: PView, keepTransform: Bool) -> CGPoint {
51-
let rect = getViewRect(view, keepTransform: keepTransform)
45+
let rect = view.getRect(keepTransform: keepTransform)
5246
return CGPoint(x: rect.minX, y: rect.minY)
5347
}
5448

5549
static func topCenter(_ view: PView, keepTransform: Bool) -> CGPoint {
56-
let rect = getViewRect(view, keepTransform: keepTransform)
50+
let rect = view.getRect(keepTransform: keepTransform)
5751
return CGPoint(x: rect.minX + (rect.width / 2), y: rect.minY)
5852
}
5953

6054
static func topRight(_ view: PView, keepTransform: Bool) -> CGPoint {
61-
let rect = getViewRect(view, keepTransform: keepTransform)
55+
let rect = view.getRect(keepTransform: keepTransform)
6256
return CGPoint(x: rect.minX + rect.width, y: rect.minY)
6357
}
6458

6559
static func centerLeft(_ view: PView, keepTransform: Bool) -> CGPoint {
66-
let rect = getViewRect(view, keepTransform: keepTransform)
60+
let rect = view.getRect(keepTransform: keepTransform)
6761
return CGPoint(x: rect.minX, y: rect.minY + (rect.height / 2))
6862
}
6963

7064
static func center(_ view: PView, keepTransform: Bool) -> CGPoint {
71-
let rect = getViewRect(view, keepTransform: keepTransform)
65+
let rect = view.getRect(keepTransform: keepTransform)
7266
return CGPoint(x: rect.minX + (rect.width / 2), y: rect.minY + (rect.height / 2))
7367
}
7468

7569
static func centerRight(_ view: PView, keepTransform: Bool) -> CGPoint {
76-
let rect = getViewRect(view, keepTransform: keepTransform)
70+
let rect = view.getRect(keepTransform: keepTransform)
7771
return CGPoint(x: rect.minX + rect.width, y: rect.minY + (rect.height / 2))
7872
}
7973

8074
static func bottomLeft(_ view: PView, keepTransform: Bool) -> CGPoint {
81-
let rect = getViewRect(view, keepTransform: keepTransform)
75+
let rect = view.getRect(keepTransform: keepTransform)
8276
return CGPoint(x: rect.minX, y: rect.minY + rect.height)
8377
}
8478

8579
static func bottomCenter(_ view: PView, keepTransform: Bool) -> CGPoint {
86-
let rect = getViewRect(view, keepTransform: keepTransform)
80+
let rect = view.getRect(keepTransform: keepTransform)
8781
return CGPoint(x: rect.minX + (rect.width / 2), y: rect.minY + rect.height)
8882
}
8983

9084
static func bottomRight(_ view: PView, keepTransform: Bool) -> CGPoint {
91-
let rect = getViewRect(view, keepTransform: keepTransform)
85+
let rect = view.getRect(keepTransform: keepTransform)
9286
return CGPoint(x: rect.minX + rect.width, y: rect.minY + rect.height)
9387
}
9488

@@ -99,66 +93,6 @@ final class Coordinates {
9993
height: ceilFloatToDisplayScale(rect.size.height))
10094
}
10195

102-
static func setViewRect(_ view: PView, toRect rect: CGRect, keepTransform: Bool) {
103-
let adjustedRect = Coordinates.adjustRectToDisplayScale(rect)
104-
105-
#if os(iOS) || os(tvOS)
106-
if keepTransform {
107-
/*
108-
To adjust the view's position and size, we don't set the UIView's frame directly, because we want to keep the
109-
view's transform (UIView.transform).
110-
By setting the view's center and bounds we really set the frame of the non-transformed view, and this keep
111-
the view's transform. So view's transforms won't be affected/altered by PinLayout.
112-
*/
113-
114-
// NOTE: The center is offset by the layer.anchorPoint, so we have to take it into account.
115-
view.center = CGPoint(x: adjustedRect.origin.x + (adjustedRect.width * view.layer.anchorPoint.x),
116-
y: adjustedRect.origin.y + (adjustedRect.height * view.layer.anchorPoint.y))
117-
// NOTE: We must set only the bounds's size and keep the origin.
118-
view.bounds.size = adjustedRect.size
119-
} else {
120-
view.frame = adjustedRect
121-
}
122-
#else
123-
if let superview = view.superview, !superview.isFlipped {
124-
var flippedRect = adjustedRect
125-
flippedRect.origin.y = superview.frame.height - flippedRect.height - flippedRect.origin.y
126-
view.frame = flippedRect
127-
} else {
128-
view.frame = adjustedRect
129-
}
130-
#endif
131-
}
132-
133-
static func getViewRect(_ view: PView, keepTransform: Bool) -> CGRect {
134-
#if os(iOS) || os(tvOS)
135-
if keepTransform {
136-
/*
137-
To adjust the view's position and size, we don't set the UIView's frame directly, because we want to keep the
138-
view's transform (UIView.transform).
139-
By setting the view's center and bounds we really set the frame of the non-transformed view, and this keep
140-
the view's transform. So view's transforms won't be affected/altered by PinLayout.
141-
*/
142-
let size = view.bounds.size
143-
// See setUntransformedViewRect(...) for details about this calculation.
144-
let origin = CGPoint(x: view.center.x - (size.width * view.layer.anchorPoint.x),
145-
y: view.center.y - (size.height * view.layer.anchorPoint.y))
146-
147-
return CGRect(origin: origin, size: size)
148-
} else {
149-
return view.frame
150-
}
151-
#else
152-
if let superview = view.superview, !superview.isFlipped {
153-
var flippedRect = view.frame
154-
flippedRect.origin.y = superview.frame.height - flippedRect.height - flippedRect.origin.y
155-
return flippedRect
156-
} else {
157-
return view.frame
158-
}
159-
#endif
160-
}
161-
16296
static func roundFloatToDisplayScale(_ pointValue: CGFloat) -> CGFloat {
16397
return CGFloat(roundf(Float(pointValue * displayScale))) / displayScale
16498
}

0 commit comments

Comments
 (0)