RBStack is a straightforward library built using Swift's Result Builder, designed to create UIStackViews declaratively, much like VStack/HStack in SwiftUI.
This library is ideal for migrating existing UIKit code to improve readability and can potentially reduce UI code by 50%.
- iOS 12.0+
- Swift 5.9+
- Xcode 15+
RBVStackandRBHStackto construct vertical and horizontal stack views. Kinds of child view expressions supported inside the builder closure including:- Optional
- If-Else
- For Loop
- Array
- Assignment statement
RBSpacerandRBDividerto simplify layout management.
You can add RBStack via Xcode or by editing Package.swift.
- Xcode:
File > Add Packages...and usehttps://github.com/lalalmove/RBStack.git. Package.swift:
dependencies:[.package(url:"https://github.com/lalalmove/RBStack.git", from:"1.0.0")],targets:[.target(
name:"YourApp",
dependencies:[.product(name:"RBStack",package:"RBStack")])]Add RBStack to your Podfile, then install.
platform:ios,'12.0'use_frameworks!target'YourApp'dopod'RBStack','~> 1.0'endThen run:
pod installCopy all files inside Sources folder into your own project.
