A lightweight SwiftUI package that provides a flexible, wrapping layout for building chip-style interfaces with clean alignment and spacing control.
Perfect for tags, categories, filters, or any horizontally flowing content.
ChipLayoutUI gives you a native SwiftUI-like API for building layouts that automatically wrap content across multiple rows.
- ⚡ Zero boilerplate usage
- 🔁 Automatic line wrapping
- 🎯 Alignment control (leading, center, trailing)
- 📏 Configurable spacing
- 🧩 Built using SwiftUI
Layoutprotocol (iOS 16+) - 🎨 Clean and minimal API
To integrate ChipLayoutUI using Swift Package Manager, add:
dependencies: [
.package(url: "https://github.com/thakur-vijay/ChipLayoutUI.git", from: "1.0.0")
]Then add to your target:
.target(
name: "YourTarget",
dependencies: ["ChipLayoutUI"]
)Or in Xcode:
File → Add Package Dependencies…
Repository URL:
https://github.com/thakur-vijay/ChipLayoutUI.git
import ChipLayoutUI- iOS 16.0+
- SwiftUI
import SwiftUI
import ChipLayoutUI
struct ContentView: View {
var body: some View {
ChipLayoutUI {
Text("Swift")
Text("iOS")
Text("SwiftUI")
Text("Layout")
}
}
}| Parameter | Description |
|---|---|
alignment |
Row alignment (.leading/.center/.trailing) |
spacing |
Space between items and rows |
- Custom SwiftUI
Layout - Dynamic row generation
- Measures and wraps views based on width
- Applies alignment per row
- Use for small, flexible content (chips/tags)
- Avoid very large views inside layout
- Keep spacing consistent for better UI
MIT License
If you find this project useful:
- ⭐ Star the repository
- 🚀 Share it with other developers