A SwiftUI custom layout demo inspired by Pinterest-style masonry grids.
This repository accompanies a blog series on building adaptive layouts using the new SwiftUI Layout protocol.
This project demonstrates a step-by-step approach to creating a custom Pinterest-style layout in SwiftUI, evolving from a simple modulo-based distribution to a more advanced adaptive solution.
-
started
Skeleton code with basic setup but no Layout protocol implementation. -
finished_modulo_solution
Initial working layout using a modulo-based item distribution approach. -
finished_optimized
Optimized, adaptive layout improving upon the initial solution, with better performance and memory handling.
- iOS 16+
- Swift 5.7+
- Xcode 14+
- Clone the repository
git clone https://github.com/belkhadir/PinterestStyleLayout.git
- Open the project
cd PinterestStyleLayout open PinterestStyleLayout.xcodeproj - Run the project Select a simulator and hit Run in Xcode.
Feedback, issues, or pull requests are welcome! If youβve tried the layout in your project or want to suggest improvements, feel free to open an issue or contribute.
Read the full blog series at: π https://swiftorbit.io
