AutorÃa | Ultima modificación | Ver Log |
//
// GridTopicView.swift
// twogetskills
//
// Created by Efrain Yanez Recanatini on 1/26/22.
//
import SwiftUI
struct GridTopicView: View {
//@EnvironmentObject var appDelegate: AppDelegate
// @EnvironmentObject var sceneDelegate: SceneDelegate
private var viewModel : TopicGridViewModel = TopicGridViewModel()
private let colorBackgroundTopic = UIColor(hex: Config.COLOR_BACKGROUND_TOPIC)
private let colorAppBar = UIColor(hex: Config.COLOR_APP_BAR)
let config = [
GridItem(.flexible()),
GridItem(.flexible())
]
var body: some View {
VStack(spacing: 0.0) {
ScrollView() {
LazyVGrid(columns: config, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/, spacing: /*@START_MENU_TOKEN@*/nil/*@END_MENU_TOKEN@*/, pinnedViews: /*@START_MENU_TOKEN@*/[]/*@END_MENU_TOKEN@*/, content: {
ForEach(0..<self.viewModel.topics.count) { i in
CardTopicView(
topicModel: self.viewModel.topics[i]
).frame(
width: Constants.CARD_WIDTH,
height: Constants.CARD_HEIGHT,
alignment: .center
)
}
}).padding(.top, 10)
}
Spacer()
} .onAppear {
print("CardTopicView")
}
.background(Color(colorBackgroundTopic ?? .gray))
}
}
struct GridTopicView_Previews: PreviewProvider {
static var previews: some View {
GridTopicView()
}
}