File tree Expand file tree Collapse file tree 4 files changed +49
-24
lines changed
Example/Example/Flow/Home/Examples
Sources/SharkStackKit/Stacks Expand file tree Collapse file tree 4 files changed +49
-24
lines changed Original file line number Diff line number Diff line change @@ -56,5 +56,6 @@ final class VerticalExampleViewController: UIViewController {
5656 label
5757 Spacer ( )
5858 } . margin ( . top( 20 ) )
59+ . withBackground ( . red)
5960 }
6061}
Original file line number Diff line number Diff line change 1+ //
2+ // File.swift
3+ //
4+ //
5+ // Created by Russell Warwick on 03/07/2021.
6+ //
7+
8+ import UIKit
9+
10+ public final class Spacer : UIView {
11+
12+ // MARK: - Init
13+
14+ public init ( ) {
15+ super. init ( frame: . zero)
16+ }
17+
18+ public init ( w: CGFloat ) {
19+ super. init ( frame: . zero)
20+ translatesAutoresizingMaskIntoConstraints = false
21+ widthAnchor. constraint ( equalToConstant: w) . isActive = true
22+ }
23+
24+ public init ( h: CGFloat ) {
25+ super. init ( frame: . zero)
26+ translatesAutoresizingMaskIntoConstraints = false
27+ heightAnchor. constraint ( equalToConstant: h) . isActive = true
28+ }
29+
30+ required public init ? ( coder: NSCoder ) { fatalError ( " init(coder:) has not been implemented " ) }
31+ }
Original file line number Diff line number Diff line change 1+ //
2+ // File.swift
3+ //
4+ //
5+ // Created by Russell Warwick on 03/07/2021.
6+ //
7+
8+ import UIKit
9+
10+ public extension UIView {
11+ @discardableResult
12+ func withBackground( _ color: UIColor ) -> Self {
13+ backgroundColor = color
14+ return self
15+ }
16+ }
17+
Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ public extension UIView {
3131 }
3232}
3333
34-
3534public final class ZStack : UIView {
3635
3736 public init ( spacing: CGFloat = . zero, @UIViewBuilder views: ( ) -> [ UIView ] ) {
@@ -108,29 +107,6 @@ public extension UIStackView {
108107 }
109108}
110109
111- public final class Spacer : UIView {
112-
113- // MARK: - Init
114-
115- public init ( ) {
116- super. init ( frame: . zero)
117- }
118-
119- public init ( w: CGFloat ) {
120- super. init ( frame: . zero)
121- translatesAutoresizingMaskIntoConstraints = false
122- widthAnchor. constraint ( equalToConstant: w) . isActive = true
123- }
124-
125- public init ( h: CGFloat ) {
126- super. init ( frame: . zero)
127- translatesAutoresizingMaskIntoConstraints = false
128- heightAnchor. constraint ( equalToConstant: h) . isActive = true
129- }
130-
131- required public init ? ( coder: NSCoder ) { fatalError ( " init(coder:) has not been implemented " ) }
132- }
133-
134110extension UIView {
135111
136112 @discardableResult
You can’t perform that action at this time.
0 commit comments