Type Safely

Share this post
Set SwiftUI backgroundColor the same way as foregroundColor
typesafely.substack.com

Set SwiftUI backgroundColor the same way as foregroundColor

Daily Coding Tip 009

Type Safely
Dec 27, 2020
Share this post
Set SwiftUI backgroundColor the same way as foregroundColor
typesafely.substack.com
Image by SS-Lw from Pixabay

It’s useful that SwiftUI has a modifier called .background() so that you can add any kind of view behind the current view. Instead of being limited to colour, your background could be an image or a more complicated shape. But when I use the .foregroundColor() modifier, I take advantage of the fact that a Color is expected by g…

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2022 Type Safely
Privacy ∙ Terms ∙ Collection notice
Publish on Substack Get the app
Substack is the home for great writing