title: Observe window resize event with SwiftUI
body: <p>I currently have a <code>LazyVGrid</code> setup as such:</p>
  <pre><code>struct NetworkGrid: View {
      var networks: [Network]
      let columns = [
              GridItem(.flexible()),
              GridItem(.flexible()),
              GridItem(.flexible()),
              GridItem(.flexible())
          ]
      
      var body: some View {
          ScrollView {
              LazyVGrid(columns: columns) {
                  ForEach(networks) { network in
                      NetworkCard(network: network)
                  }
              }
          }
      }
  }
  </code></pre>
  <p>I would like to set the number of grid columns based on the current window size, i.e.</p>
  <pre><code>func windowDidResize(_ notification: Notification) {
      itemWidth = CGFloat(300)
      if window.width &lt;= itemWidth {
          GridItem(.flexible()), GridItem(.flexible())
      } else if window.width &lt;= itemWidth * 2 {
          GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())
      } else if window.width &lt;= itemWidth * 3 {
          GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())
      }
      ...
  }
  </code></pre>
  <p>How would I go about implementing such an observer with SwiftUI?</p>