title: Calculate number of items per row based on their width in SwiftUI
body: <p>This is an extension of my previous question (<a href="https://stackoverflow.com/questions/57577462/get-width-of-a-view-using-in-swiftui/57591483#57591483">Get width of a view using in SwiftUI</a>)</p>
  
  <p>I need to implement a layout where number of items per row is determined dynamically, based on their combined width (basically, place items in a row until they no longer fit).</p>
  
  <p><img src="https://i.imgur.com/uWXEOhZ.png" alt="two muppets" title="tooltip"></p>
  
  <p>I've been told that using the GeometryReader is a hacky way to do something in a declarative language, which is obviously true.</p>
  
  <p>I have also been directed to this CollectionView-like component <a href="https://github.com/Q-Mobile/QGrid" rel="noreferrer">https://github.com/Q-Mobile/QGrid</a> but the solution is static as the number of rows and cells per row is determined once, before any components are rendered.</p>
  
  <p>I have no idea how to approach this, so any advice is very valuable for me!</p>
  
  <p>❤️❤️❤️</p>