Have a lot of thanks....
Of Course. Here ist Code for ImageCard....
import Swift UI
struct ImageCard: View {
var images: Images
var body: some View {
NavigationView{
ZStack(alignment: .bottom) {
Image(images.image)
.resizable()
.cornerRadius(18)
.frame(width: 200)
.scaledToFit()
VStack(alignment: .leading)
Text("\(images.category)")
.frame(width: 200, height: 40, alignment: .center )
.background(.ultraThinMaterial)
.cornerRadius(18)
.bold()
}
.frame(width: 200, height: 200)
.shadow(radius: 3)
}
}
}
struct ImageCard_Previews: PreviewProvider {
static var previews: some View {
ImageCard(images: ImagesList[0])
}
}
And here is the Code of my model
import Foundation
struct Images: Identifiable {
var id = UUID()
var name: String
var category: String
var image: String
}
var ImagesList = [Images(name: "Steinkirchen", category: "Landschaften", image: "Uebersicht_1"),
Images(name: "Seacloud-Spirit",category: "Maritimes", image: "Uebersicht_2"),
Images(name: "Grashalm", category: "Natur", image: "Uebersicht_3"),
Images(name: "Details", category: "Projekte", image: "Uebersicht_4"),
Images(name: "Festmacher", category: "Schwarz/Weiß", image: "Uebersicht_5")
]
struct Land: Identifiable {
var id = UUID()
var name: String
var category: String
var image: String
}
var LandList = [Images(name: "Helgoland", category: "Die Lange Anna", image: "Landschaften_1"),
Images(name: "Thunersee",category: "Thunersee/Schweiz", image: "Landschaften_2"),
Images(name: "Steinkirchen", category: "Das Alte Land", image: "Landschaften_3"),
Images(name: "Steinkirchen", category: "Das Alte Land", image: "Landschaften_4"),
Images(name: "Thunersee", category: "Thunersee/Schweiz", image: "Landschaften_5"),
Images(name: "Steinkirchen", category: "Das Alte Land", image: "Landschaften_6")
]
struct Maritimes: Identifiable {
var id = UUID()
var name: String
var category: String
var image: String
}
var MaritimesList = [Images(name: "Amerigo Vespucci", category: "3-Master", image: "Maritimes_1"),
Images(name: "Festmacher",category: "Festmacher", image: "Maritimes_2"),
Images(name: "Hapag", category: "Containerschiff", image: "Maritimes_3"),
Images(name: "Fischkutter", category: "Kutter", image: "Maritimes_4"),
Images(name: "Festmacher", category: "Festmacher", image: "Maritimes_5"),
Images(name: "Seacloud-Spirit", category: "3-Master", image: "Maritimes_6")
]
And there will be all correct, here is the code for
import SwiftUI
struct ContentView: View {
var columns = [GridItem(.adaptive(minimum: 160), spacing: 5)]
var body: some View {
NavigationView {
ScrollView {
LazyVGrid(columns: columns) {
ForEach(ImagesList, id: \.id) { images in
NavigationLink {
LandCard()
} label: {
ImageCard(images: images)
}
}
}
.padding(10)
}
.navigationBarTitle(Text("Übersicht"))
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Have so many thanks, for helping me on this weekend...
Greeting from Germany