0

我有这个自适应LazyVGrid设置,问题是我希望将小单元格包裹到 1 个大单元格的空间中,但我找不到合适的方法来做到这一点

这就是我的网格

import SwiftUI

struct SubjectsView: View {
    
    @Environment(\.managedObjectContext) private var moc
    @FetchRequest(entity: Subject.entity(), sortDescriptors: []) private var subjects: FetchedResults<Subject>
    
    var body: some View {
        ScrollView(.vertical, showsIndicators: false) {
            LazyVGrid(columns: [GridItem(.adaptive(minimum: 360), spacing: 16, alignment: .top)], spacing: 16) {
                ForEach(subjects, id: \.self) { subject in
                    SubjectCell(subject: subject)
                }
                Spacer()
            }.padding(15)
        }
    }
}

模拟器

模拟器

4

0 回答 0