How do I make the highest a part of the record background to remain fastened?
For instance, right here, the higher a part of the record background (the sunshine gray) mustn’t slide up. In different phrases, the record background ought to solely be allowed to maneuver in the direction of the underside of the display.
import SwiftUI
import Basis
struct Attendance: Identifiable {
let id = UUID()
let title: String
}
struct AttendanceRow: View {
var attendance: Attendance
var physique: some View {
HStack {
Textual content(attendance.title)
}
.padding(.vertical, 20)
}
}
struct ContentView: View {
let attendances = [
Attendance(name: "John"),
Attendance(name: "Michael"),
Attendance(name: "Steve"),
Attendance(name: "Donald"),
Attendance(name: "Johathan"),
Attendance(name: "William"),
Attendance(name: "Dave"),
Attendance(name: "Richard"),
Attendance(name: "Boris"),
Attendance(name: "Catherine"),
Attendance(name: "Susan")
]
var physique: some View {
NavigationView {
VStack {
Record {
ForEach(attendances) { attendance in
AttendanceRow(attendance: attendance)
}
}
}
}
}
}