]> git.r.bdr.sh - rbdr/map/blob - Map/Presentation/Base Components/EvolutionPicker.swift
c68e90cdf51ce6c8896e0e43119abc1050060fdc
[rbdr/map] / Map / Presentation / Base Components / EvolutionPicker.swift
1 import SwiftUI
2
3 struct EvolutionPicker: View {
4
5 @EnvironmentObject private var store: AppStore
6
7 private var selectedEvolution: Binding<StageType> {
8 Binding(
9 get: { store.state.selectedEvolution },
10 set: { evolution in
11 store.send(.selectEvolution(evolution: evolution))
12 }
13 )
14 }
15
16 var body: some View {
17 Picker("Evolution", selection: selectedEvolution) {
18 ForEach(StageType.types) { stage in
19 Text(Stage.title(stage)).tag(stage).padding(4.0)
20 }
21 Divider()
22 ForEach(StageType.characteristics) { stage in
23 Text(Stage.title(stage)).tag(stage).padding(4.0)
24 }
25 Divider()
26 ForEach(StageType.properties) { stage in
27 Text(Stage.title(stage)).tag(stage).padding(4.0)
28 }
29 Divider()
30 ForEach(StageType.custom) { stage in
31 Text(Stage.title(stage)).tag(stage).padding(4.0)
32 }
33 }.padding(.horizontal, 8.0).padding(.vertical, 4.0)
34 }
35 }
36
37 struct EvolutionPicker_Previews: PreviewProvider {
38 static var previews: some View {
39 EvolutionPicker()
40 }
41 }