@@ -43,19 +43,6 @@ public final class Flex {
4343 public var intrinsicSize : CGSize {
4444 return yoga. intrinsicSize
4545 }
46-
47- /**
48- This`direction` property is get the direction flex items are placed in the flex container.
49- */
50- public var direction : Direction ? {
51- switch yoga. flexDirection {
52- case . column: return Flex . Direction. column
53- case . columnReverse: return Flex . Direction. columnReverse
54- case . row: return Flex . Direction. row
55- case . rowReverse: return Flex . Direction. rowReverse
56- @unknown default : return nil
57- }
58- }
5946
6047 init ( view: UIView ) {
6148 self . view = view
@@ -182,7 +169,34 @@ public final class Flex {
182169 //
183170 // MARK: Direction, wrap, flow
184171 //
185-
172+
173+ /**
174+ The `direction` property establishes the main-axis, thus defining the direction flex items are placed in the flex container.
175+
176+ The `direction` property specifies how flex items are laid out in the flex container, by setting the direction of the flex
177+ container’s main axis. They can be laid out in two main directions, like columns vertically or like rows horizontally.
178+
179+ Note that row and row-reverse are affected by the layout direction (see `layoutDirection` property) of the flex container.
180+ If its text direction is LTR (left to right), row represents the horizontal axis oriented from left to right, and row-reverse
181+ from right to left; if the direction is rtl, it's the opposite.
182+
183+ - Parameter value: Default value is .column
184+ */
185+ public var direction : Direction ? {
186+ get {
187+ switch yoga. flexDirection {
188+ case . column: return Flex . Direction. column
189+ case . columnReverse: return Flex . Direction. columnReverse
190+ case . row: return Flex . Direction. row
191+ case . rowReverse: return Flex . Direction. rowReverse
192+ @unknown default : return nil
193+ }
194+ }
195+ set {
196+ direction ( newValue ?? . column)
197+ }
198+ }
199+
186200 /**
187201 The `direction` property establishes the main-axis, thus defining the direction flex items are placed in the flex container.
188202
0 commit comments