釣魚術
SwiftUI
.navigationTitle(fishCate)
struct FishCategoryView: View {
var fishCate: String
var toxicfishes: [FishRect]
var body: some View {
HStack {
Text(fishCate).font(.system(size: 40))
Spacer()
}
.padding(.leading, 20)
VStack {
//List(toxicfishes, id: \.self) { toxicfish in // 每一種魚
ForEach(toxicfishes, id: \.self) { toxicfish in
// Fish Rectangle
if toxicfish.fishCategory == fishCate {
FishCardView(
imgName: toxicfish.imageName,
fishName: toxicfish.fishName,
fishNickName: toxicfish.fishNickName)
} // end of 每一種魚
}
.listRowSeparator(.hidden)
}
}
}
https://developer.apple.com/documentation/swiftui/lazyvstack