title: How can I create a custom view that only displays a grid of lines?
body: <p>I'm making a test app to see what it's like to use SwiftUI, and I want my test app to have a custom view which is a grid of perpendicular lines, with spacing specified as state variables.</p>
  
  <p>However, I can't figure out how to do this in a UI system that seems to have no custom drawing methods.</p>
  
  <pre class="lang-swift prettyprint-override"><code>import SwiftUI
  
  
  
  struct GridBackgroundView : View {
  
      @State var horizontalSpacing: CGFloat = 48
      @State var verticalSpacing: CGFloat = 48
      @State var anchor: Anchor&lt;CGPoint&gt;.Source = .center
  
  
      var numberOfHorizontalGridLines: UInt {
          return // Something?
      }
  
      var numberOfVerticalGridLines: UInt {
          return // Something?
      }
  
  
      var body: some View {
          Group {
              ForEach(0 ... numberOfHorizontalGridLines) { _ in
                  // Something?
              }
              ForEach(0 ... numberOfVerticalGridLines) { _ in
                  // Something?
              }
          }
      }
  }
  
  #if DEBUG
  struct GridView_Previews : PreviewProvider {
      static var previews: some View {
          GridBackgroundView()
      }
  }
  #endif
  </code></pre>
  
  <p>I don't know what to put in the <code>// Something?</code> areas. There's no line view built into SwiftUI, and I can't for the life of me find out what the width of the view is (possibly because that's not part of a <code>View</code> in SwiftUI?)</p>