.italic()

The .italic() view modifier method in SwiftUI can be used to make text within a view appear in italic style.

Syntax

Text("This text will be italic")
.italic()

Example

var body: some View {
Text("I hope this appears as italic.")
.italic()
}

This will display:

SwiftUI ViewModifier Italic

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn SwiftUI on Codecademy