DevTechie
Published in

DevTechie

New in SwiftUI 3: foregroundStyle

Introduced in iOS 15 and SwiftUI 3, foregroundStyle is a new modifier which can be used to apply color or pattern as foreground to view. This modifier can be applied to style content of text, shapes, symbols, images etc.

Let’s start by setting foreground style with orange color:

struct ForegroundStyleExample: View {
var body: some View {
VStack {
Text("DevTechie")
Image(systemName: "globe")
Capsule()
.frame(height: 50)
.overlay {
Text("SwiftUI 3")…

--

--

--

DevTechie.com is all about sharing knowledge by practical means. We focus on solving real world challenges via code.

Recommended from Medium

SwiftUI Animations: Recreating the Roomba vacuum animation

React Native vs Swift: Which to Choose for an iOS App

Creating Bar Chart in SwiftUI

iOS 13: The Unsung Heroes of 2019

An Introduction to PencilKit in iOS

TronLink Weekly Report (2021.9.20–2021.9.26)

How to create a new Xcode project without Storyboard ?

Swift5.3 — 2.Basic Operators

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
DevTechie

DevTechie

DevTechie creates tutorials at www.youtube.com/c/DevTechie. Also video courses on: www.udemy.com/user/devtechie/ and courses on: www.patreon.com/DevTechieInc

More from Medium

Disclosure Group in SwiftUI

Presenting The Preferences Window On macOS Using SwiftUI

SwiftUI Tutorial: Working with TextEditor

How to add Firebase to a SwiftUI Project with SPM

SwiftUI with Xcode and Firebase logo