How to create grid of square items (for example like in iOS Photo Library) with SwiftUI?
I tried this approach but it doesn\'t work:
var body: some
Although the next WWDC is right around the corner, we're still missing a collection view in SwiftUI. I have tried to provide a decent example on how to create your own SwiftUI collection view using UIViewControllerRepresentable and Combine. I opted for creating my own collection view instead of using open source libraries as either I felt they were missing some key features or were bloated with too many things. In my example, I have used UICollectionViewDiffableDataSource and UICollectionViewCompositionalLayout to create the collection view. It supports both pullToRefresh and pagination functionality.
The full implementation can be found in: https://github.com/shabib87/SwiftUICollectionView.