SwiftUI: Layout & Interfaces

Nov 18 2021 · Swift 5.5, iOS 15, Xcode 13

Part 1: Dynamic View Layout

07. Challenge: Grids with Pinned Views

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 06. PinnedScrollableViews Next episode: 08. Conclusion

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Now, we finally come to the part of the course where you see what that colorful subgenre view you’ve been using was inspired by.

          LazyVGrid(
            columns: [.init()]
          ) {
            genre.subgenres.randomElement()!.view
          }
          ) {
            ForEach(genre.subgenres, content: \.view)
          }
            columns: [.init(.adaptive(minimum: 150))]
(minimum: 110)
(minimum: 150)
          let genre = Genre.list.randomElement()!

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