IOS TOPICS

IOS Introduction
Swift UI Label
Swift UI Button
Swift UI Text Field
Swift UI Slider
Swift UI Switch
Swift UI Stepper
Swift UI Date Picker
Swift UI Segmented Control
Views
Table View
Collection Views
SCROLL VIEW
iOS Content View
iOS View Controllers
iOS Bar interface
iOS Navigation interface
iOS Architect Pattern
iOS Libraries
iOS Web request and parsing
iOS user defaults
iOS Coredata and database

Add background colour


To add background colour to your label text :

Code:

Label { Text("Location") .foregroundColor(Color.white) .background(Color.black) } icon: { Image(systemName: "pin") .foregroundColor(Color.black)}

Output:

ios output

To add a box/background to your whole label:

Code:

struct ContentView: View { var body: some View { Label { Text("Location") .foregroundColor(Color.white) } icon: { Image(systemName: "pin") .foregroundColor(Color.white) }.padding(10) .background(Color.black) } }

Output:

ios output