This commit is contained in:
anlicheng 2025-02-19 23:35:16 +08:00
parent c5508bdf7c
commit 158b8db646

View File

@ -82,19 +82,34 @@ struct IndexView: View {
}
.background(GeometryReader { geometry in
Color.clear.onChange(of: geometry.frame(in: .global).minY) {_, offset in
let contentHeight = geometry.size.height
let scrollViewHeight = UIScreen.main.bounds.height
//
if offset + contentHeight > scrollViewHeight - 50 {
}
})
Rectangle()
.frame(height: 0)
.background(GeometryReader {
geometry in
Color.clear.onChange(of: geometry.frame(in: .global).minY) {_, offset in
let frame = geometry.frame(in: .global)
let screenBounds = UIScreen.main.bounds
/*
if frame.intersects(screenBounds) {
print("call me here11")
}
*/
if screenBounds.height - frame.minY > 50 {
print("call me here")
Task {
await self.loadMoreUpdateDramas()
}
}
}
})
if self.isLoading {
ProgressView()
}
}
}
.task {
@ -108,12 +123,11 @@ struct IndexView: View {
self.dramas = result.dramas
self.showUpdateDramas = Self.yes(updateDramas: result.updateDramas)
}
}
}
@MainActor
private func loadMoreUpdateDramas() async {
guard !self.isLoading else {
return