Mastodon
Episode 71

The Owl That Is SwiftUI

00:00:00
/
01:22:32

March 1st, 2022

1 hr 22 mins 32 secs

Season 1

Your Hosts
Tags

About this Episode

Welcome to Code Completion, Episode 71! We are a group of iOS developers and educators hoping to share what we love most about development, Apple technology, and completing your code!

Follow us @CodeCompletion on Twitter to hear about our upcoming livestreams, videos, and other content.

Today, we discuss:

  • SwiftUI’s layout model:
  • Color and ZStack:

    ZStack {
        Color.clear
            .frame(height: 1)
        Text("Hi!")
    }
    
  • Content Shape:

    Color.clear
        .contentShape(Rectangle())
        .onTapGesture { print("tapped") }
    
  • Button Padding:

    Button(action: doTheThing) {
        Text("Do It")
            .padding(20)
    }.padding(-20)
    
  • Equal Widths:

    HStack {
        Text("Hello, world!")
            .fixedSize(horizontal: true, vertical: false)
            .padding()
            .frame(maxWidth: .infinity)
            .background(Color.green)
    
        Text("Hi!")
            .fixedSize(horizontal: true, vertical: false)
            .padding()
            .frame(maxWidth: .infinity)
            .background(Color.green)
    }.background(Color.red)
    .frame(width: 250)
    
  • Commented Out:

Your hosts for this week:

Be sure to also sign up to our monthly newsletter, where we will recap the topics we discussed, reveal the answers to #CompleteTheCode, and share even more things we learned in between episodes.

You are what makes this show possible, so please be sure to share this with your friends and family who are also interested in any part of the app development process.

Sponsor

This week's episode of Code Completion is brought to you by Sticky Widgets. Go to https://apps.apple.com/app/apple-store/id1533254320?pt=1765080&ct=CodeCompletion&mt=8 today to check it out!