New Label View In SwiftUI

Creating Image and Text is a common scenario that’s why since the second version of SwiftUI we have a new view called Label. It’s Image and Text combined.

As you may expect, it needs two things some text and the name of the image.

Let’s use some system images.

Label(“Trash”, systemImage: “trash.fill”)

You can change its color or font as well.


It’s fine for simple views but what if you want different colors for image and text.

There is an option to create a more complex view of Text and Image.

For example, multi-color of Text or different color for the image.

Label {
    } icon: {
    Image(systemName: “star.fill”)

If you want to remove space between texts you can use + to concatenate them.