Proyectos de Subversion Iphone Microlearning

Rev

Autoría | Ultima modificación | Ver Log |

//
//  MainView.swift
//  twogetskills
//
//  Created by Efrain Yanez Recanatini on 2/17/22.
//

import SwiftUI


struct MainView: View {
    
    
    private let colorWindowBackground = UIColor(hex: Config.COLOR_WINDOW_BACKGROUND)
    private let colorAppBar = UIColor(hex: Config.COLOR_APP_BAR)
    
    @State var selection = 0
  
    private let tabNavigationTitles  = ["Tópicos", "Linea de Tiempo", "Progreso", "Perfil"]

    
    var body: some View {
       
        
        TabView(selection: $selection) {

            GridTopicView()
                .font(.system(size: 30, weight: .bold, design: .rounded))
                .tabItem {
                    Image(systemName: "books.vertical")
                    Text("Tópicos")
                }
                .tag(0)



            
            TimeLineView().font(.system(size: 30, weight: .bold, design: .rounded))
                .tabItem {
                    Image(systemName: "clock.arrow.circlepath")
                    Text("Linea de Tiempo")
                }
                .tag(1)

            
            MyProgressView().font(.system(size: 30, weight: .bold, design: .rounded))
                .tabItem {
                    Image(systemName: "chart.bar")
                    Text("Progreso")
                }
                .tag(2)

            
            
           ProfileView().font(.system(size: 30, weight: .bold, design: .rounded))
                .tabItem {
                    Image(systemName: "person")
                    Text("Perfil")
                }
                .tag(3)

      
        }
        .background(Color(colorWindowBackground ?? .gray))
        .navigationBarTitleDisplayMode(.inline)
        .navigationBarBackButtonHidden(true)
        .navigationTitle(tabNavigationTitles[selection])
       



    }
}

struct MainView_Previews: PreviewProvider {
    static var previews: some View {
        MainView()
    }
}

struct NavigationConfigurator: UIViewControllerRepresentable {
    
    var configure: (UINavigationController) -> Void = { _ in }

    func makeUIViewController(context: UIViewControllerRepresentableContext<NavigationConfigurator>) -> UIViewController {
        UIViewController()
    }
    
    func updateUIViewController(_ uiViewController: UIViewController, context: UIViewControllerRepresentableContext<NavigationConfigurator>) {
        if let nc = uiViewController.navigationController {
            self.configure(nc)
        }
    }

}