Wayne Filkins Wayne Filkins - 1 year ago 137
Swift Question

How to use scrollView functions with AsyncDisplayKit

I have this function I use on my collection view:

func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>){

It doesn't seem to work now that I have converted over to using AsyncDisplayKit. The collection view is not an ASCollectionView and that function doesn't give any errors but it just doesn't work now. In the docs I read about scrollNode but I'm not sure if that replaces scrollview. It sounds more like it wraps around it so I don't see why scrollView can no longer be accessed.

Answer Source

Okay I figured it out and it was really simple. All I had to do was make it an asyncDelegate like this:

collectionView.asyncDelegate = self

So I feel kind of dumb because this is as simple as making it a UICollectionViewDelegate. I guess I just didn't realize that I hadn't done that yet or else I would have had an error when converting it from UICollectionView to ASCollectionView and just changed it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download