@@ -17,7 +17,11 @@ class CardView: UIView {
1717 let dateLabel = UILabel ( )
1818 let messageLabel = UILabel ( )
1919 let expandButton = UIButton ( type: . contactAdd)
20- let frameLayout = StackFrameLayout ( axis: . horizontal)
20+ let frameLayout = HStackLayout ( ) {
21+ $0. spacing = 15.0
22+ $0. padding ( top: 15 , left: 15 , bottom: 15 , right: 15 )
23+ $0. debug = true
24+ }
2125 let blueView = UIView ( )
2226 let redView = UIView ( )
2327 var messageFrameLayout : FrameLayout !
@@ -61,7 +65,7 @@ class CardView: UIView {
6165 $0. textColor = . black
6266 }
6367
64- [ blueView, redView, earthImageView, rocketImageView, nameLabel, titleLabel, dateLabel, messageLabel, expandButton] . forEach { addSubview ( $0) }
68+ [ blueView, redView, earthImageView, rocketImageView, nameLabel, titleLabel, dateLabel, messageLabel, expandButton, frameLayout ] . forEach { addSubview ( $0) }
6569
6670 // Standard syntax:
6771
@@ -107,12 +111,7 @@ class CardView: UIView {
107111 $0. spacing = 10
108112
109113 ( $0 + [ Label ( . yellow) , Label ( . green) , Label ( . brown) , Label ( . systemPink) , Label ( . blue) ] ) . forEach {
110- $0. willSizeThatFitsBlock = { ( sender, size) in
111- if let label = sender. targetView as? UILabel {
112- label. text = " \( size. width) x \( size. height) "
113- }
114- }
115- $0. willLayoutSubviewsBlock = { sender in
114+ $0. didLayoutSubviewsBlock = { sender in
116115 if let label = sender. targetView as? UILabel {
117116 let size = sender. frame. size
118117 label. text = " \( size. width) x \( size. height) "
@@ -126,10 +125,7 @@ class CardView: UIView {
126125 $0. spacing = 5.0
127126 }
128127
129- frameLayout. spacing = 15.0
130- frameLayout. padding ( top: 15 , left: 15 , bottom: 15 , right: 15 )
131- frameLayout. debug = true
132- addSubview ( frameLayout)
128+
133129 }
134130
135131 func Label( _ color: UIColor ) -> UILabel {
0 commit comments