Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  MainView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 2/17/22.
6
//
7
 
8
import SwiftUI
9
 
10
 
11
struct MainView: View {
12
 
13
 
14
    private let colorWindowBackground = UIColor(hex: Config.COLOR_WINDOW_BACKGROUND)
15
    private let colorAppBar = UIColor(hex: Config.COLOR_APP_BAR)
16
 
17
    @State var selection = 0
18
 
19
    private let tabNavigationTitles  = ["Tópicos", "Linea de Tiempo", "Progreso", "Perfil"]
20
 
21
 
22
    var body: some View {
23
 
24
 
25
        TabView(selection: $selection) {
26
 
27
            GridTopicView()
28
                .font(.system(size: 30, weight: .bold, design: .rounded))
29
                .tabItem {
30
                    Image(systemName: "books.vertical")
31
                    Text("Tópicos")
32
                }
33
                .tag(0)
34
 
35
 
36
 
37
 
38
            TimeLineView().font(.system(size: 30, weight: .bold, design: .rounded))
39
                .tabItem {
40
                    Image(systemName: "clock.arrow.circlepath")
41
                    Text("Linea de Tiempo")
42
                }
43
                .tag(1)
44
 
45
 
46
            MyProgressView().font(.system(size: 30, weight: .bold, design: .rounded))
47
                .tabItem {
48
                    Image(systemName: "chart.bar")
49
                    Text("Progreso")
50
                }
51
                .tag(2)
52
 
53
 
54
 
55
           ProfileView().font(.system(size: 30, weight: .bold, design: .rounded))
56
                .tabItem {
57
                    Image(systemName: "person")
58
                    Text("Perfil")
59
                }
60
                .tag(3)
61
 
62
 
63
        }
64
        .background(Color(colorWindowBackground ?? .gray))
65
        .navigationBarTitleDisplayMode(.inline)
66
        .navigationBarBackButtonHidden(true)
67
        .navigationTitle(tabNavigationTitles[selection])
68
 
69
 
70
 
71
 
72
    }
73
}
74
 
75
struct MainView_Previews: PreviewProvider {
76
    static var previews: some View {
77
        MainView()
78
    }
79
}
80
 
81
struct NavigationConfigurator: UIViewControllerRepresentable {
82
 
83
    var configure: (UINavigationController) -> Void = { _ in }
84
 
85
    func makeUIViewController(context: UIViewControllerRepresentableContext<NavigationConfigurator>) -> UIViewController {
86
        UIViewController()
87
    }
88
 
89
    func updateUIViewController(_ uiViewController: UIViewController, context: UIViewControllerRepresentableContext<NavigationConfigurator>) {
90
        if let nc = uiViewController.navigationController {
91
            self.configure(nc)
92
        }
93
    }
94
 
95
}