SwiftUI Label : Custom View

If you need more control over title and icon, you can use other overload of init which supports ViewBuilder closure. It’s signature looks like this:

public init(@ViewBuilder title: () -> Title, @ViewBuilder icon: () -> Icon)
You can use this to create custom views for title and icon.

Label {
    Text("DevTechie")
        .font(.largeTitle.lowercaseSmallCaps())
} icon: {
    Image(systemName: "bolt")
        .rotationEffect(.degrees(-90))
}

Output: