comparison Simoleon/ContentView.swift @ 53:b0bce2c8e4a9

Refactor UK spelling to US
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Tue, 27 Jul 2021 09:44:51 +0100
parents 7a6a7c677851
children aa451ca55e48
comparison
equal deleted inserted replaced
52:3fa127885e60 53:b0bce2c8e4a9
11 @Environment(\.managedObjectContext) private var viewContext 11 @Environment(\.managedObjectContext) private var viewContext
12 @FetchRequest(sortDescriptors: []) private var defaultCurrency: FetchedResults<DefaultCurrency> 12 @FetchRequest(sortDescriptors: []) private var defaultCurrency: FetchedResults<DefaultCurrency>
13 13
14 @State private var tab: Tab = .convert 14 @State private var tab: Tab = .convert
15 15
16 private enum Tab {
17 case convert, favorites, settings
18 }
19
16 var body: some View { 20 var body: some View {
17 TabView(selection: $tab) { 21 TabView(selection: $tab) {
18 Conversion(currencyPair: defaultCurrency.first?.pair ?? "USD/GBP") 22 Conversion(currencyPair: defaultCurrency.first?.pair ?? "USD/GBP")
19 .tabItem { 23 .tabItem {
20 Text("Convert", comment: "Tab bar button to show conversion") 24 Label("Convert", systemImage: "arrow.counterclockwise.circle")
21 Image(systemName: "arrow.counterclockwise.circle")
22 } 25 }
23 .tag(Tab.convert) 26 .tag(Tab.convert)
24 .accessibilityIdentifier("Convert") 27 .accessibilityIdentifier("Convert")
25 28
26 Favourites() 29 Favorites()
27 .tabItem { 30 .tabItem {
28 Text("Favourites", comment: "Tab bar button to show favourites") 31 Label("Favorites", systemImage: "star")
29 Image(systemName: "star")
30 } 32 }
31 .tag(Tab.favourites) 33 .tag(Tab.favorites)
32 .accessibilityIdentifier("Favourites") 34 .accessibilityIdentifier("Favorites")
33 35
34 Settings() 36 Settings()
35 .tabItem { 37 .tabItem {
36 Text("Settings", comment: "Tab bar button to show settings") 38 Label("Settings", systemImage: "gear")
37 Image(systemName: "gear")
38 } 39 }
39 .tag(Tab.settings) 40 .tag(Tab.settings)
40 .accessibilityIdentifier("Settings") 41 .accessibilityIdentifier("Settings")
41 } 42 }
42 }
43
44 private enum Tab {
45 case convert, favourites, settings
46 } 43 }
47 } 44 }
48 45
49 struct ContentView_Previews: PreviewProvider { 46 struct ContentView_Previews: PreviewProvider {
50 static var previews: some View { 47 static var previews: some View {
51 ContentView() 48 ContentView()
49 .environment(\.locale, Locale(identifier: "es"))
52 } 50 }
53 } 51 }