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