Search code examples
swiftmacosscrollnsscrollviewnscollectionview

Load more data when NSCollectionView is scrolled to end of content (macOS)


In my macOS application I have an NSCollectionView. I downloaded data and put that in the collection view, and now I want to load more data when the user scrolls to the bottom of the available content. On iOS, I could do something like this with UIScrollViewDelegate.scrollViewDidEndDragging(_:willDecelerate:), but I'm unsure how to do this on macOS.

How can I trigger a load when the user scrolls to the bottom of the view?


Solution

  • it looks, I solved it. Create an observation. And connect nscollectionview's scrollview and use this when I scrolling..:

    if (self.scrollViewColl.verticalScroller?.floatValue.isEqual(to: 1.0))! && loading == false