krz/daybyday

iOS app for children to learn days of the week, months, and seasons with audio assist.

clone: git clone https://gitbay.org/krz/daybyday.git

v1.3.2: AnimalsView.swift · raw

 1//
 2//  AnimalsView.swift
 3//  DayByDay
 4//
 5
 6import SwiftUI
 7
 8/// Displays 12 animals as large, tappable cards in a scrollable grid.
 9/// Adapts between 1 and 2 columns depending on available width.
10struct AnimalsView: View {
11    private let columns = [
12        GridItem(.adaptive(minimum: 300, maximum: 500), spacing: 24)
13    ]
14
15    var body: some View {
16        ScrollView {
17            LazyVGrid(columns: columns, spacing: 24) {
18                ForEach(LearnAnimal.allCases) { animal in
19                    AnimalCard(animal: animal)
20                        .frame(height: 200)
21                }
22            }
23            .padding(32)
24        }
25    }
26}
27
28#Preview {
29    AnimalsView()
30}