Member-only story

SwiftUI: HStack but with wrapping

Creating a shopping app or an Instagram alternative? Looking for a stylish way to display Tags, Categories, Selections, Items lists or Keywords? You’re in the right place! In this article, I’ll present you a solution for implementing a beautiful, easy-to-use solution without relying on third-party dependencies or complex SwiftUI hacks. That’s right — no extra dependencies, just clean, straightforward SwiftUI.

Liudas Baronas
8 min readSep 3, 2024

Our goal

Our goal is to to create a fully fluid, dynamic, flexible, and reusable component that seamlessly integrates any SwiftUI view and can be integrated into any SwiftUI view as well. In other words, a layout solution that adapts to varying content sizes without disrupting the overall layout.

Our WrappingCollectionView solves a simple problem — SwiftUI not providing a straightforward ability to incorporate flexible collection views based on dynamic sizes of child views. Using a traditional grid or list view may not provide the desired flexibility, as these items can get truncated or require excessive scrolling.

--

--

Liudas Baronas
Liudas Baronas

No responses yet