Customising Labels
Labels can be customised using the labelStyle() modifier.
To display only titles use
Code:
import SwiftUI
struct ContentView: View {
var body: some View {
Label("Location", systemImage: "pin")
.labelStyle(IconOnlyLabelStyle())
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Output:
To display only images use
Code:
import SwiftUI
struct ContentView: View {
var body: some View {
Label("Location", systemImage: "pin")
.labelStyle(TitleOnlyLabelStyle())
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Output: