SwiftUI: Layout & Interfaces

Nov 18 2021 Swift 5.5, iOS 15, Xcode 13

Part 1: Dynamic View Layout

6. PinnedScrollableViews

Episode complete

Play next episode

About this episode
See versions

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 5. Grids Next episode: 7. Challenge: Grids with Pinned Views

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

Take your career further with a Kodeco Pro subscription. 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.

Update Notes: This course was originally recorded in 2020. It has been reviewed and all content and materials updated as of October 2021.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

In this course, you’ve been working with sections of views. But you haven’t used SwiftUI’s Section View. In this episode, that will change! Sections are used for adding headers and footers to views, and there are a couple of associated options available to you. Let’s check ’em out.

        ForEach(Genre.list) { genre in
          Section(header: )
          ForEach(genre.subgenres.prefix(5)) {
        ForEach(Genre.list) { genre in
          Section(header: genre.header) {
            ForEach(genre.subgenres.prefix(5)) {
              $0.view.frame(width: 125)
LazyVStack(pinnedViews: /*@START_MENU_TOKEN@*/[]/*@END_MENU_TOKEN@*/) {
LazyVStack(pinnedViews: .sectionHeaders) {
            header: genre.header,
            footer: genre.header
          ) {
LazyVStack(pinnedViews: [.sectionHeaders, .sectionFooters]) {
LazyHStack(pinnedViews: [.sectionHeaders, .sectionFooters]) {
ScrollView(.horizontal) {
        pinnedViews: [.sectionHeaders, .sectionFooters]
      ) {
rows: .init(repeating: .init(), count: 6),
ForEach(genre.subgenres) {