This article was written using Xcode 14 and iOS 16
Introduction
You can easily make Text bold by using the SwiftUI .bold
modifier.
struct ContentView: View {
var body: some View {
Text("SwiftlyRush")
.bold()
}
}
You can now pass through a isActive
boolean value for this bold modifier and this applies to many modifiers now, so you can remove those custom ones ;]
struct ContentView: View {
var body: some View {
Text("SwiftlyRush")
.bold(false)
}
}
Your result here is the text won’t be bold, this is super useful if you want the state of the bold text based on data dynamically changing.