title: SwiftUI WidgetKit: How to anchor views to the top
body: <p>I am attempting to layout a tableView using SwiftUI and WidgetKit and would like to achieve a similar result of that as the Apple's Notes widget.</p>
  <p>My current implementation succeeds in laying out the view in the <code>.systemLarge</code> widget, but not in the <code>.systemMedium</code> widget. I would like to pin the view to the top of the widget, such that the header of &quot;FAVOURITES&quot; is visible in the <code>.systemMedium</code>.</p>
  <pre><code>struct PlacesWidgetEntryView : View {
      var entry: Provider.Entry
  
      let places = [
          Place(name: &quot;Place 1&quot;, imageName: &quot;baseline_star_black_24pt&quot;),
          Place(name: &quot;Place 2&quot;, imageName: &quot;baseline_star_black_24pt&quot;),
          Place(name: &quot;Place 3&quot;, imageName: &quot;baseline_star_black_24pt&quot;),
          Place(name: &quot;Place 4&quot;, imageName: &quot;baseline_star_black_24pt&quot;),
          Place(name: &quot;Place 5&quot;, imageName: &quot;baseline_star_black_24pt&quot;),
  
      ]
      
      var body: some View {
          VStack {
              //Header
              HStack {
                  Text(&quot;FAVOURITES&quot;)
                      .bold()
                      .frame(height: 8)
                  Spacer()
              }
              .padding()
              .background(Color.blue)
  
              //TableView
              LazyVStack {
                  ForEach(places, id: \.self) { place in
                      PlaceRow(place: place)
                  }
              }
              Spacer()
          }
      }
  }
  
  struct PlaceRow: View {
      let place: Place
      
      var body: some View {
          HStack {
              Text(place.name)
                  .font(.body)
              Spacer()
              Image(place.imageName)
                  .resizable()
                  .frame(width: 28, height: 28, alignment: .center)
          }
          .padding(.horizontal)
          .padding(.vertical, 4)
      }
  }
  </code></pre>
  <p>Implementation outcome:</p>
  <p><a href="https://i.stack.imgur.com/KRsG0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KRsG0.png" alt="enter image description here" /></a></p>
  <p>The above is <code>.systemLarge</code>, which is good, and as per what I'm expecting.</p>
  <p><a href="https://i.stack.imgur.com/WMV4q.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WMV4q.png" alt="enter image description here" /></a></p>
  <p>The above is <code>.systemMedium</code>, which is not what I'm expecting. I would like to see &quot;Favourites&quot; anchored to the top of the widgetView, and potentially the tableView overflowing to the bottom.</p>