File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -127,15 +127,23 @@ extension UIView: AutoSizeCalculable {
127127 }
128128
129129 public func autoSizeThatFits( _ size: CGSize , layoutClosure: ( ) -> Void ) -> CGSize {
130- Pin . autoSizingInProgress = true
131- autoSizingRect = CGRect ( origin: CGPoint . zero, size: size)
130+ let isAlreadyAutoSizing = Pin . autoSizingInProgress
131+
132+ if ( !isAlreadyAutoSizing) {
133+ Pin . autoSizingInProgress = true
134+ autoSizingRect = CGRect ( origin: CGPoint . zero, size: size)
135+ }
136+
132137 layoutClosure ( )
133138
134139 let boundingRect = subviews. compactMap ( { $0. autoSizingRectWithMargins } ) . reduce ( CGRect . zero) { ( result: CGRect , autoSizingRect: CGRect ) -> CGRect in
135140 return result. union ( autoSizingRect)
136141 }
137142
138- Pin . autoSizingInProgress = false
143+ if !isAlreadyAutoSizing {
144+ Pin . autoSizingInProgress = false
145+ }
146+
139147 return boundingRect. size
140148 }
141149}
You can’t perform that action at this time.
0 commit comments