From 68aa9013ce80cbc262da15636300b5dee10a492f Mon Sep 17 00:00:00 2001
From: yuzushioh
Date: Sun, 15 Mar 2020 15:56:53 +0900
Subject: [PATCH] fix segmented control
---
README.md | 11 ++++++-----
.../input/{segmented_control => picker}/1.png | Bin
2 files changed, 6 insertions(+), 5 deletions(-)
rename assets/images/input/{segmented_control => picker}/1.png (100%)
diff --git a/README.md b/README.md
index 9f5e197..8601411 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@
- [TextField](#textfield)
- [Slider](#slider)
- [Date Picker](#date-picker)
- - [Segmented Control](#segmented-control)
+ - [Picker](#picker)
- [Stepper](#stepper)
- [Tap](#tap)
- [Gesture](#gesture)
@@ -65,7 +65,7 @@
| UIAlertController with style .actionSheet | [ActionSheet](#alerts-and-action-sheets) |
| UIStackView with horizontal axis| [HStack](#hstack) |
| UIStackView with vertical axis| [VStack](#vstack) |
-| UISegmentedControl | [SegmentedControl](#segmented-control) |
+| UISegmentedControl | [Picker](#picker) |
| UIStepper | [Stepper](#stepper) |
| UIDatePicker | [DatePicker](#date-picker) |
| NSAttributedString | No equivalent (use [Text](#text)) |
@@ -454,24 +454,25 @@ DatePicker(
-### Segmented Control
+### Picker
``` swift
@State var favoriteColor = 0
var colors = ["Red", "Green", "Blue"]
-SegmentedControl(selection: $favoriteColor) {
+Picker("Favorite Color", selection: $favoriteColor) {
ForEach(0 ..< colors.count) { index in
Text(self.colors[index])
.tag(index)
}
}
+.pickerStyle(SegmentedPickerStyle())
```
Screenshot
-![](./assets/images/input/segmented_control/1.png)
+![](./assets/images/input/picker/1.png)
diff --git a/assets/images/input/segmented_control/1.png b/assets/images/input/picker/1.png
similarity index 100%
rename from assets/images/input/segmented_control/1.png
rename to assets/images/input/picker/1.png