SwiftUI Modifiers

Hey CodeCrew!

How do you customize the behavior, position and style of SwiftUI elements?

Using modifiers of course!

I just released a new YouTube video where I break down common modifiers. Check out the brand new video right here:
https://bit.ly/37cT35E

Here’s some of the cool things you’ll learn how to do:

  • How to easily add drop shadows to anything
  • How to resize images
  • How to change fonts, colors and backgrounds

Question of the day: Do you like SwiftUI better than UIKit? Leave me a comment below!

2 Likes

Hey, Chris!
Thank you for the lesson! I have to say I like SwiftUI more and more with every next tutorial :sweat_smile:
The Challenge was interesting and helpful :grinning:

4 Likes

Cool! Glad you enjoyed the challenge. :clap:

2 Likes

SwiftUI! It is so easy to read and understand (when you have watched your tutorials :wink:)

Instead of typing out a ton, I included a video with a few things to point out and ask about:

  1. Do the top “layers” in a ZStack inherit the bottom “layer”'s properties? If so, I wouldn’t use the background image as a layer.
  2. Instead of using the background image (“breakfast”) as the first or bottom layer in the ZStack, I instead used a .background modifier on the ZStack to pass the image to it. I used .scaledToFill() instead of .aspectRatio(contentMode: .fill) That seemed to work better for the background image.
  3. Does anyone know where are or how do I use the device class modifiers in SwiftUI? It was easy to find in UIKit by looking in the Inspector panel.
1 Like

Thank you for sharing as i was stuck on this :slight_smile:

1 Like

This was my take on it.

1 Like

I really enjoy this challenges! Thanks Chris