Skip to content

Commit d090171

Browse files
committed
make stacks public
1 parent 2279dae commit d090171

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

Sources/MasonryStack/MasonryHStack.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,25 @@
77

88
import SwiftUI
99

10-
struct MasonryHStack: Layout {
10+
public struct MasonryHStack: Layout {
1111

12-
var rows: Int = 2
13-
var spacing: Double = 8
12+
private var rows: Int
13+
private var spacing: Double
1414

15-
func sizeThatFits(
15+
init(rows: Int = 2, spacing: Double = 8.0) {
16+
self.rows = rows
17+
self.spacing = spacing
18+
}
19+
20+
public func sizeThatFits(
1621
proposal: ProposedViewSize,
1722
subviews: Subviews,
1823
cache: inout ()
1924
) -> CGSize {
2025
return calculateSize(for: subviews, in: proposal)
2126
}
2227

23-
func placeSubviews(
28+
public func placeSubviews(
2429
in bounds: CGRect,
2530
proposal: ProposedViewSize,
2631
subviews: Subviews,
@@ -73,7 +78,7 @@ struct MasonryHStack: Layout {
7378
)
7479
}
7580

76-
static var layoutProperties: LayoutProperties {
81+
public static var layoutProperties: LayoutProperties {
7782
var properties = LayoutProperties()
7883
properties.stackOrientation = .horizontal
7984
return properties

Sources/MasonryStack/MasonryVStack.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,25 @@
77

88
import SwiftUI
99

10-
struct MasonryVStack: Layout {
10+
public struct MasonryVStack: Layout {
1111

12-
var columns: Int = 2
13-
var spacing: Double = 8
12+
private var columns: Int
13+
private var spacing: Double
1414

15-
func sizeThatFits(
15+
public init(columns: Int = 2, spacing: Double = 8.0) {
16+
self.columns = columns
17+
self.spacing = spacing
18+
}
19+
20+
public func sizeThatFits(
1621
proposal: ProposedViewSize,
1722
subviews: Subviews,
1823
cache: inout ()
1924
) -> CGSize {
2025
return calculateSize(for: subviews, in: proposal)
2126
}
2227

23-
func placeSubviews(
28+
public func placeSubviews(
2429
in bounds: CGRect,
2530
proposal: ProposedViewSize,
2631
subviews: Subviews,
@@ -73,7 +78,7 @@ struct MasonryVStack: Layout {
7378
)
7479
}
7580

76-
static var layoutProperties: LayoutProperties {
81+
public static var layoutProperties: LayoutProperties {
7782
var properties = LayoutProperties()
7883
properties.stackOrientation = .vertical
7984
return properties

0 commit comments

Comments
 (0)