Type Safely

Type Safely

Share this post

Type Safely
Type Safely
Set SwiftUI backgroundColor the same way as foregroundColor

Set SwiftUI backgroundColor the same way as foregroundColor

Daily Coding Tip 009

Type Safely's avatar
Type Safely
Dec 27, 2020
∙ Paid

Share this post

Type Safely
Type Safely
Set SwiftUI backgroundColor the same way as foregroundColor
Share
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…

Keep reading with a 7-day free trial

Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Type Safely
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share