A super fast and easy-to-use layout library for iOS. FrameLayoutKit supports complex layouts, including chaining and nesting layout with simple and intuitive operand syntax.
It simplifies the UI creation process, resulting in cleaner and more maintainable code.
Say NO to autolayout constraint nightmare:
Autolayout | FrameLayoutKit |
FrameLayoutKit is available through Swift Package Manager
(Recommended) and CocoaPods:
Regardless, make sure to import the project wherever you may use it:
import FrameLayoutKit
FrameLayoutKit can be installed as a CocoaPod. To install, include this in your Podfile.
pod "FrameLayoutKit"
Swift Package Manager is recommended to install FrameLayoutKit.
- Click
File
Add Packages...
- Specify the git URL for FrameLayoutKit.
https://github.com/kennic/FrameLayoutKit.git
Some examples of how FrameLayoutKit works:
Two types of code syntax:
Regular syntax | Chained syntax |
frameLayout.distribution = .center
frameLayout.spacing = 16
frameLayout.isFlexible = true |
frameLayout
.distribution(.center)
.spacing(16)
.flexible() |
In FrameLayoutKit
, DSL (Domain Specific Language) syntax provides a more declarative and readable way to define layouts, much like SwiftUI. This syntax is particularly used in VStackView
, HStackView
, and ZStackView
. These views support DSL, allowing you to add standard UIKit views directly or customize them with Item(view)
for more control over size and position. It simplifies the process of creating and managing layouts by offering a SwiftUI-like declarative approach, making your code more readable and easier to maintain.
let titleLabel = UILabel()
let descriptionLabel = UILabel()
let actionButton = UIButton()
let vStackLayout = VStackView {
titleLabel
descriptionLabel
SpaceItem(20) // Adds a space of 20 points
Item(actionButton).minWidth(120) // Customizes the button's minimum width
}
FrameLayoutKit is one of the fastest layout libraries.
See: Layout libraries benchmark's project
- Swift Package Manager
- CocoaPods support
- Objective-C version (Deprecated - Not recommended)
- Swift version
- Examples
- Documents
Nam Kennic, [email protected]
FrameLayoutKit is available under the MIT license. See the LICENSE file for more info.