A SwiftUI flow layout for wrapping views dynamically, designed to make it easy to layout chips, tags, or any dynamic set of items. Swiflow supports Swift 6.0 and provides a convenient API to integrate into your project.
- Wraps content automatically to new rows when space is insufficient.
- Customizable spacing between items.
- Compatible with SwiftUI's
ViewBuilder
. - Supports dynamic content sizes using SwiftUI’s preference system.
- In Xcode, select File > Add Packages....
- Enter the package repository URL (if hosting on GitHub or another remote).
- Choose Dependency Rule and Add Package to your project.
Or update your Package.swift
directly:
// swift-tools-version: 5.5
import PackageDescription
let package = Package(
name: "YourProject",
dependencies: [
.package(url: "https://github.com/YourUser/Swiflow.git", .upToNextMajor(from: "1.0.0"))
],
targets: [
.target(name: "YourTarget",
dependencies: [
.product(name: "Swiflow", package: "Swiflow")
]),
]
)
import Swiflow
Define an array of items you want to display:
let items = [
"Swift", "Xcode", "Apple Intelligence", "Combine",
"CreateML", "SwiftTesting", "Vision", "RealityKit",
"SwiftUI", "SwiftData"
]
Use FlowItem or create your own custom view to display the items:
Swiflow(items) { item in
FlowItem(text: item)
}
This library is released under the MIT License. Feel free to use it in your own projects. Contributions are welcome!