Skip to content

Commit 70afd70

Browse files
committed
Separated setGap and remove getGap
1 parent 7d73362 commit 70afd70

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

Sources/Swift/FlexLayout.swift

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,40 +1216,43 @@ public final class Flex {
12161216
//
12171217
// MARK: Gap
12181218
//
1219+
1220+
/**
1221+
Set distance between columns.
1222+
1223+
- Parameters:
1224+
- value: distance
1225+
- Returns: flex interface
1226+
*/
1227+
@discardableResult
1228+
public func columnGap(_ value: CGFloat) -> Flex {
1229+
yoga.columnGap = value
1230+
return self
1231+
}
12191232

12201233
/**
1221-
Get setted value through func `setGap(_ gutter: Gutter, _ value: CGFloat)`.
1234+
Set distance between rows.
12221235

1223-
- Parameter gutter: directions
1224-
- Returns: distance
1236+
- Parameters:
1237+
- value: distance
1238+
- Returns: flex interface
12251239
*/
12261240
@discardableResult
1227-
public func getGap(_ gutter: Gutter) -> CGFloat {
1228-
switch gutter {
1229-
case .column: return yoga.columnGap
1230-
case .row: return yoga.rowGap
1231-
case .all: return yoga.gap
1232-
}
1241+
public func rowGap(_ value: CGFloat) -> Flex {
1242+
yoga.rowGap = value
1243+
return self
12331244
}
1234-
1245+
12351246
/**
1236-
Set distance between rows and columns.
1247+
Set distance between both of rows and columns.
12371248

12381249
- Parameters:
1239-
- gutter: directions
12401250
- value: distance
12411251
- Returns: flex interface
12421252
*/
12431253
@discardableResult
1244-
public func setGap(_ gutter: Gutter, _ value: CGFloat) -> Flex {
1245-
switch gutter {
1246-
case .column:
1247-
yoga.columnGap = value
1248-
case .row:
1249-
yoga.rowGap = value
1250-
case .all:
1251-
yoga.gap = value
1252-
}
1254+
public func gap(_ value: CGFloat) -> Flex {
1255+
yoga.gap = value
12531256
return self
12541257
}
12551258

@@ -1456,12 +1459,6 @@ public final class Flex {
14561459
case none
14571460
}
14581461

1459-
public enum Gutter {
1460-
case column
1461-
case row
1462-
case all
1463-
}
1464-
14651462
/*public enum Overflow {
14661463
/// Items that overflow
14671464
case visible

0 commit comments

Comments
 (0)