Skip to content

Repository files navigation

ChipLayoutUI 🧩

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.


✨ Why ChipLayoutUI?

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 Layout protocol (iOS 16+)
  • 🎨 Clean and minimal API

📱 Demo

ScreenRecording2026-05-02at7 52 25PM-ezgif com-video-to-gif-converter

🚀 Installation

Swift Package Manager

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

import ChipLayoutUI

🛠 Requirements

  • iOS 16.0+
  • SwiftUI

💡 Usage

import SwiftUI
import ChipLayoutUI

struct ContentView: View {
    var body: some View {
        ChipLayoutUI {
            Text("Swift")
            Text("iOS")
            Text("SwiftUI")
            Text("Layout")
        }
    }
}

⚙️ Configuration Options

Parameter Description
alignment Row alignment (.leading/.center/.trailing)
spacing Space between items and rows

🧠 How It Works

  • Custom SwiftUI Layout
  • Dynamic row generation
  • Measures and wraps views based on width
  • Applies alignment per row

🎯 Best Practices

  • Use for small, flexible content (chips/tags)
  • Avoid very large views inside layout
  • Keep spacing consistent for better UI

📄 License

MIT License

⭐ Support

If you find this project useful:

  • ⭐ Star the repository
  • 🚀 Share it with other developers

About

A lightweight, high-performance SwiftUI library for building self-sizing, wrapping chip layouts. Unlike standard grids, this package utilizes the iOS 18 Subviews API to dynamically calculate line breaks based on content width, ensuring an organic flow for tags, filters, or keyword collections.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages