Skip to content

Commit 6534c50

Browse files
committed
no message
1 parent 7c483e5 commit 6534c50

File tree

3 files changed

+39
-10
lines changed

3 files changed

+39
-10
lines changed

FrameLayoutKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'FrameLayoutKit'
3-
s.version = '7.0.4'
3+
s.version = '7.0.5'
44
s.summary = 'FrameLayoutKit is a super fast and easy to use layout kit'
55
s.description = <<-DESC
66
FrameLayoutKit is a powerful Swift library designed to streamline the process of creating user interfaces. With its intuitive operator syntax and support for nested functions, developers can effortlessly construct complex UI layouts with minimal code. By leveraging the flexibility of operators, developers can easily position and arrange views within a container view, enabling precise control over the visual hierarchy. Additionally, the library offers a range of convenient functions for configuring view properties, such as setting dimensions, margins, and alignment. Whether you're building a simple screen or a complex interface, FrameLayoutKit simplifies the UI creation process, resulting in cleaner, more maintainable code.

FrameLayoutKit/Classes/Extensions/StackFrameLayout+DSL.swift

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import UIKit
99

1010
@resultBuilder
11-
public struct ViewBuilder {
11+
public struct FLViewBuilder {
1212

1313
static public func buildBlock(_ views: UIView...) -> [UIView] { views }
1414

@@ -19,13 +19,13 @@ public struct ViewBuilder {
1919

2020
```
2121
let stack = HStackView {
22-
UILabel()
23-
UIButton()
22+
UILabel()
23+
UIButton()
2424
}
2525
*/
2626
open class HStackView: HStackLayout {
2727

28-
public init(@ViewBuilder builder: () -> [UIView]) {
28+
public init(@FLViewBuilder builder: () -> [UIView]) {
2929
super.init()
3030
add(builder())
3131
}
@@ -45,13 +45,13 @@ open class HStackView: HStackLayout {
4545

4646
```
4747
let stack = VStackView {
48-
UILabel()
49-
UIButton()
48+
UILabel()
49+
UIButton()
5050
}
5151
*/
5252
open class VStackView: VStackLayout {
5353

54-
public init(@ViewBuilder builder: () -> [UIView]) {
54+
public init(@FLViewBuilder builder: () -> [UIView]) {
5555
super.init()
5656
add(builder())
5757
}
@@ -77,7 +77,7 @@ open class VStackView: VStackLayout {
7777
*/
7878
open class ZStackView: ZStackLayout {
7979

80-
public init(@ViewBuilder builder: () -> [UIView]) {
80+
public init(@FLViewBuilder builder: () -> [UIView]) {
8181
super.init()
8282
add(builder())
8383
}
@@ -95,8 +95,17 @@ open class ZStackView: ZStackLayout {
9595

9696
// MARK: -
9797

98+
/**
99+
Enable DSL syntax:
100+
101+
```
102+
let stack = VStackView {
103+
StackItem(label).padding(12)
104+
StackItem(button).aligns(.center, .center).padding(4)
105+
}
106+
*/
98107
open class StackItem<T: UIView>: FrameLayout {
99-
var content: T?
108+
public var content: T?
100109

101110
public required init(_ view: T?) {
102111
super.init()
@@ -117,6 +126,16 @@ open class StackItem<T: UIView>: FrameLayout {
117126

118127
// MARK: - Spacing
119128

129+
/**
130+
Enable DSL syntax:
131+
132+
```
133+
let stack = VStackView {
134+
StackItem(label).padding(12)
135+
SpaceItem(10)
136+
StackItem(button).aligns(.center, .center).padding(4)
137+
}
138+
*/
120139
open class SpaceItem: FrameLayout {
121140

122141
public required init(_ value: CGFloat = 0) {
@@ -134,6 +153,16 @@ open class SpaceItem: FrameLayout {
134153

135154
}
136155

156+
/**
157+
Enable DSL syntax:
158+
159+
```
160+
let stack = VStackView {
161+
StackItem(label).padding(12)
162+
FlexibleSpace()
163+
StackItem(button).aligns(.center, .center).padding(4)
164+
}
165+
*/
137166
open class FlexibleSpace: FrameLayout {
138167

139168
public required init(_ value: CGFloat = 0) {

0 commit comments

Comments
 (0)