Swiftpack.co - smyshlaevalex/FlowStackLayout as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by smyshlaevalex.
smyshlaevalex/FlowStackLayout 1.0.1
SwiftUI wrapping stack implementation using Layout protocol (iOS 16+)
⭐️ 14
🕓 1 year ago
iOS macOS watchOS tvOS macCatalyst
.package(url: "https://github.com/smyshlaevalex/FlowStackLayout.git", from: "1.0.1")

FlowStackLayout

FlowStack acts like a HStack until there are no more space for new cells, then FlowStack will wrap to the next row

FlowStack supports vertical and horizontal alignment

Horizontal alignment will align rows

Vertical alignment will align cells based on row height

FlowStackLayout conforms to Layout protocol, while FlowStack conforms to View and wraps FlowStackLayout

View modifiers can't be used with Layout protocol, so FlowStack is preferred for normal use

FlowStack(alignment: Alignment = .center, horizontalSpacing: Double? = nil, verticalSpacing: Double? = nil, content: @escaping () -> Content)

FlowStack {
    ForEach(0...20, id: \.self) {
        Text(String($0))
            .foregroundColor(Color(uiColor: .systemBackground))
            .padding([.leading, .trailing])
            .frame(height: 30)
            .background {
                Capsule()
                    .fill(.mint)
            }
    }
}

FlowStackLayout(alignment: Alignment = .center, horizontalSpacing: Double? = nil, verticalSpacing: Double? = nil)

let layout = isVertical ? AnyLayout(VStack()) : AnyLayout(FlowStackLayout())

layout {
  
}

Installation

Swift Package Manager

https://github.com/smyshlaevalex/FlowStackLayout.git

GitHub

link
Stars: 14
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics