comparison Simoleon/Settings.swift @ 22:3596690dda73

Add Config files and implementing Settings
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Tue, 20 Jul 2021 09:02:51 +0100
parents
children 699b5bb619db
comparison
equal deleted inserted replaced
21:c3dda63f50ed 22:3596690dda73
1 //
2 // Settings.swift
3 // Simoleon
4 //
5 // Created by Dennis Concepción Martín on 19/07/2021.
6 //
7
8 import SwiftUI
9
10 struct Settings: View {
11 let currencyPairs: [String] = parseJson("CurrencyPairs.json")
12 @State private var selectedCurrencyPair = "USD/GBP"
13
14 var body: some View {
15 List {
16 Section(header: Text("Preferences")) {
17 Picker("Default currency", selection: $selectedCurrencyPair) {
18 ForEach(currencyPairs.sorted(), id: \.self) { currencyPair in
19 Text(currencyPair)
20 }
21 }
22 }
23
24 Section(header: Text("Stay in touch")) {
25 HStack {
26 Image(systemName: "heart.fill")
27 .foregroundColor(Color(.systemRed))
28 .imageScale(.large)
29
30 Text("Rate Simoleon")
31 }
32
33 Link(destination: URL(string: "https://dennistech.io")!) {
34 HStack {
35 Image("TwitterLogo")
36 .resizable()
37 .frame(width: 30, height: 30)
38
39 Text("Follow on Twitter")
40 }
41 }
42
43 Link(destination: URL(string: "https://dennistech.io/contact")!) {
44 HStack {
45 Image(systemName: "envelope.circle.fill")
46 .renderingMode(.original)
47 .imageScale(.large)
48
49 Text("Contact")
50 }
51 }
52 }
53
54 Section(header: Text("About")) {
55 Link("Website", destination: URL(string: "https://dennistech.io")!)
56 Link("Privacy Policy", destination: URL(string: "https://dennistech.io")!)
57 }
58 }
59 .listStyle(InsetGroupedListStyle())
60 .navigationTitle("Settings")
61 .if(UIDevice.current.userInterfaceIdiom == .phone) { content in
62 NavigationView { content }
63 }
64 }
65 }
66
67 struct Settings_Previews: PreviewProvider {
68 static var previews: some View {
69 Settings()
70 }
71 }