# SwiftUI: Layout & Interfaces, Episode 7: Challenge: Grids with Pinned Views | raywenderlich.com

**URL:** <https://forums.kodeco.com/t/swiftui-layout-interfaces-episode-7-challenge-grids-with-pinned-views-raywenderlich-com/158432>\
**Category:** 🎓 Courses & Articles\
**Created:** [November 24, 2021, 8:12am UTC](https://forums.kodeco.com/t/swiftui-layout-interfaces-episode-7-challenge-grids-with-pinned-views-raywenderlich-com/158432 "2021-11-24T08:12:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcatterwaul](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jcatterwaul/32/94210_2.png) [@jcatterwaul](https://forums.kodeco.com/u/jcatterwaul)\
**Post date:** [November 24, 2021, 8:12am UTC](https://forums.kodeco.com/t/swiftui-layout-interfaces-episode-7-challenge-grids-with-pinned-views-raywenderlich-com/158432/1 "2021-11-24T08:12:31Z")

</div>

Create a colorful, vertically-scrolling grid-based layout, which resembles the “Search” view from Apple Music.

* * *
This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/28684964-swiftui-layout-interfaces/lessons/7](https://www.raywenderlich.com/28684964-swiftui-layout-interfaces/lessons/7)

---

<div class="post-metadata">

**Author:** ![themadbrewer](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/themadbrewer/32/105896_2.png) [@themadbrewer](https://forums.kodeco.com/u/themadbrewer)\
**Post date:** [February 21, 2022, 7:06pm UTC](https://forums.kodeco.com/t/swiftui-layout-interfaces-episode-7-challenge-grids-with-pinned-views-raywenderlich-com/158432/2 "2022-02-21T19:06:42Z")

</div>

I am curious as to why you did a LazyVGrid within a LazyVStack?

I just did a LazyVGrid at the top with ForEach for Genre and within that a ForEach for the Subgenre . It seems to have the same functionality but maybe I am missing something.

---

<div class="post-metadata">

**Author:** ![jessycatterwaul](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jessycatterwaul/32/110937_2.png) [@jessycatterwaul](https://forums.kodeco.com/u/jessycatterwaul)\
**Post date:** [February 21, 2022, 7:36pm UTC](https://forums.kodeco.com/t/swiftui-layout-interfaces-episode-7-challenge-grids-with-pinned-views-raywenderlich-com/158432/3 "2022-02-21T19:36:34Z")

</div>

I’m curious as well! But it’s been quite a while since I made this and I unfortunately don’t remember.

Here’s the better solution:

```swift
LazyVGrid(
  columns: [.init(.adaptive(minimum: 150))],
  pinnedViews: .sectionHeaders
) {
  ForEach(Genre.list) { genre in
    Section(header: genre.header.id(genre)) {
      ForEach(genre.subgenres, content: \.view)
    }
  }
}
.padding(.horizontal)

```

---

<div class="post-metadata">

**Author:** ![themadbrewer](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/themadbrewer/32/105896_2.png) [@themadbrewer](https://forums.kodeco.com/u/themadbrewer)\
**Post date:** [February 21, 2022, 7:40pm UTC](https://forums.kodeco.com/t/swiftui-layout-interfaces-episode-7-challenge-grids-with-pinned-views-raywenderlich-com/158432/4 "2022-02-21T19:40:30Z")

</div>

That is pretty much what I did. I was worried there was some hidden reason that might bite me later 🙂

SwiftUI makes me nervous in the same way Kotlin for Android does – makes lots of things easier but there is a lot of “magic” behind the scenes that you have little control over 🙂

But I am forging ahead to learn enough to convert my existing UIKit apps…
