@@ -61,11 +61,6 @@ extension UIView: Layoutable, SizeCalculable {
6161 public func setRect( _ rect: CGRect , keepTransform: Bool ) {
6262 let adjustedRect = Coordinates< View> . adjustRectToDisplayScale( rect)
6363
64- guard !Pin. autoSizingInProgress else {
65- autoSizingRect = adjustedRect
66- return
67- }
68-
6964 if keepTransform {
7065 /*
7166 To adjust the view's position and size, we don't set the UIView's frame directly, because we want to keep the
@@ -108,7 +103,7 @@ extension UIView: AutoSizeCalculable {
108103 static var pinlayoutAutoSizingRectWithMargins = UnsafeMutablePointer< Int8> . allocate( capacity: 1 )
109104 }
110105
111- public var autoSizingRect : CGRect ? {
106+ private var autoSizingRect : CGRect ? {
112107 get {
113108 return objc_getAssociatedObject ( self , & pinlayoutAssociatedKeys. pinlayoutAutoSizingRect) as? CGRect
114109 }
@@ -117,7 +112,7 @@ extension UIView: AutoSizeCalculable {
117112 }
118113 }
119114
120- public var autoSizingRectWithMargins : CGRect ? {
115+ private var autoSizingRectWithMargins : CGRect ? {
121116 get {
122117 return objc_getAssociatedObject ( self , & pinlayoutAssociatedKeys. pinlayoutAutoSizingRectWithMargins) as? CGRect
123118 }
@@ -126,6 +121,11 @@ extension UIView: AutoSizeCalculable {
126121 }
127122 }
128123
124+ public func setAutoSizingRect( _ rect: CGRect , margins: PEdgeInsets ) {
125+ self . autoSizingRect = Coordinates< View> . adjustRectToDisplayScale( rect)
126+ self . autoSizingRectWithMargins = Coordinates< View> . adjustRectToDisplayScale( rect. inset ( by: margins) )
127+ }
128+
129129 public func autoSizeThatFits( _ size: CGSize , layoutClosure: ( ) -> Void ) -> CGSize {
130130 Pin . autoSizingInProgress = true
131131 autoSizingRect = CGRect ( origin: CGPoint . zero, size: size)
0 commit comments