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

What is Segmented Control in SwiftUI


What is Segmented Control in SwiftUI?

Segmented control in SwiftUI is the equivalent of UISegmentedControl from the UIKit. Its a horizontal bar with multiple partitioned button that are mutually exclusive in terms of control and hence requires unique tags for identification and the segmented control, overall needs to be bound to a state variable.

Declaration:

Picker("< Label string >", selection: $< binding variable name >, content: {

Text("< label of first button >").tag(0)

Text("< label of first button >").tag(1)

Text("< label of first button >").tag(2)