I wish to make my first app – it will likely be my resume(cv). Here’s what i created in my thoughts:
-i wish to have a number of buttons related with many views. all displayed in grid with 2 columns
-inside of every view i’ll have various things, like training data, gallery, and later – my portfolio apps.
please assist me – i wish to be part of one way or the other views with titles – how am i able to do it higher with out json?
i did it like this:
-views and titles are achieved individually.
is there any higher method to do that with out json?
import SwiftUI
struct ContentView: View {
let columns = [
GridItem(.flexible()),
GridItem(.flexible())
]
let buttonsViews: [AnyView] = [
AnyView(AboutView()),
AnyView(EducationView()),
AnyView(GalleryView())
]
let titles: [String] = [
"About",
"Education",
"Gallery"
]
var physique: some View {
NavigationStack{
LazyVGrid(columns: columns) {
ForEach(buttonsViews.indices, id: .self) { ind in
NavigationLink("(titles[ind])") {
buttonsViews[ind]
}
.body(peak: 50)
.body(minWidth: 100)
.foregroundColor(.purple)
.padding()
.background(Colour.black)
.cornerRadius(5)
}
}
}
}
}