Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
kennic committed Sep 30, 2023
1 parent 7c483e5 commit 6534c50
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion FrameLayoutKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'FrameLayoutKit'
s.version = '7.0.4'
s.version = '7.0.5'
s.summary = 'FrameLayoutKit is a super fast and easy to use layout kit'
s.description = <<-DESC
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.
Expand Down
47 changes: 38 additions & 9 deletions FrameLayoutKit/Classes/Extensions/StackFrameLayout+DSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import UIKit

@resultBuilder
public struct ViewBuilder {
public struct FLViewBuilder {

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

Expand All @@ -19,13 +19,13 @@ public struct ViewBuilder {

```
let stack = HStackView {
UILabel()
UIButton()
UILabel()
UIButton()
}
*/
open class HStackView: HStackLayout {

public init(@ViewBuilder builder: () -> [UIView]) {
public init(@FLViewBuilder builder: () -> [UIView]) {
super.init()
add(builder())
}
Expand All @@ -45,13 +45,13 @@ open class HStackView: HStackLayout {

```
let stack = VStackView {
UILabel()
UIButton()
UILabel()
UIButton()
}
*/
open class VStackView: VStackLayout {

public init(@ViewBuilder builder: () -> [UIView]) {
public init(@FLViewBuilder builder: () -> [UIView]) {
super.init()
add(builder())
}
Expand All @@ -77,7 +77,7 @@ open class VStackView: VStackLayout {
*/
open class ZStackView: ZStackLayout {

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

// MARK: -

/**
Enable DSL syntax:

```
let stack = VStackView {
StackItem(label).padding(12)
StackItem(button).aligns(.center, .center).padding(4)
}
*/
open class StackItem<T: UIView>: FrameLayout {
var content: T?
public var content: T?

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

// MARK: - Spacing

/**
Enable DSL syntax:

```
let stack = VStackView {
StackItem(label).padding(12)
SpaceItem(10)
StackItem(button).aligns(.center, .center).padding(4)
}
*/
open class SpaceItem: FrameLayout {

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

}

/**
Enable DSL syntax:

```
let stack = VStackView {
StackItem(label).padding(12)
FlexibleSpace()
StackItem(button).aligns(.center, .center).padding(4)
}
*/
open class FlexibleSpace: FrameLayout {

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

0 comments on commit 6534c50

Please sign in to comment.