import SwiftUI struct ContentGridView: View { let items: [ContentItem] var onNearEnd: (() -> Void)? private let columns = [ GridItem(.adaptive(minimum: 130, maximum: 180), spacing: 12) ] var body: some View { LazyVGrid(columns: columns, spacing: 16) { ForEach(items) { item in NavigationLink(value: item) { ContentCardView(item: item) } .buttonStyle(.plain) .onAppear { if let onNearEnd, isNearEnd(item) { onNearEnd() } } } } } private func isNearEnd(_ item: ContentItem) -> Bool { guard let index = items.firstIndex(where: { $0.id == item.id }) else { return false } return index >= items.count - 4 } }