SwiftUI: Layout & Interfaces

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

Part 2: Aligning Views

17. Challenge: 3-Axis Layout

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: 16. GeometryReader Next episode: 18. 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.

Notes: 17. Challenge: 3-Axis Layout

This course was originally recorded in 2019. 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.

Welcome to you final SwiftUI layout challenge!

  var body: some View {
    GeometryReader { proxy in
      Image("Catground")
    GeometryReader { proxy in
      ZStack {
        Image("Catground")
          .resizable()
          .scaledToFit()

        Image("Badge")
          .resizable()
          .scaledToFit()
      }
    }
      .frame(width: 300)
          .scaledToFit()
          .frame(width: proxy.size.width / 3)
      }
ZStack(alignment: .bottomTrailing) {
          .frame(width: proxy.size.width / 3)
          .padding(proxy.size.width / 30)
      }
.padding(-proxy.size.width / 30)
.frame(width: 100)
.frame(width: 300)
    GeometryReader { proxy in
      Image("Catground")
        .resizable()
        .scaledToFit()

      Image("Badge")
        .resizable()
        .scaledToFit()
        .frame(width: proxy.size.width / 3)
        .padding(-proxy.size.width / 30)
    }
        .overlay(
          Image("Badge")
            .resizable()
            .scaledToFit()
            .frame(width: proxy.size.width / 3)
            .padding(-proxy.size.width / 30),
          alignment: <#T##Alignment#>)
        .scaledToFit()
        .overlay(
          Image("Badge")
            .resizable()
            .scaledToFit()
            .frame(width: proxy.size.width / 3)
            .padding(-proxy.size.width / 30),
          alignment: .bottomTrailing
        )
    }