File tree Expand file tree Collapse file tree 2 files changed +22
-12
lines changed Expand file tree Collapse file tree 2 files changed +22
-12
lines changed Original file line number Diff line number Diff line change 77
88import 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
Original file line number Diff line number Diff line change 77
88import 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
You can’t perform that action at this time.
0 commit comments