diff --git a/VirtualListView/Apple/CvDelegate.ios.maccatalyst.cs b/VirtualListView/Apple/CvDelegate.ios.maccatalyst.cs index 3870a0a..b1deabe 100644 --- a/VirtualListView/Apple/CvDelegate.ios.maccatalyst.cs +++ b/VirtualListView/Apple/CvDelegate.ios.maccatalyst.cs @@ -17,7 +17,7 @@ public CvDelegate(VirtualListViewHandler handler, UICollectionView collectionVie internal readonly WeakReference NativeCollectionView; internal readonly VirtualListViewHandler Handler; - public WeakReference> ScrollHandler { get; set; } + public Action ScrollHandler { get; set; } public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath) => HandleSelection(collectionView, indexPath, true); @@ -49,8 +49,7 @@ void HandleSelection(UICollectionView collectionView, NSIndexPath indexPath, boo public override void Scrolled(UIScrollView scrollView) { - if (ScrollHandler?.TryGetTarget(out var handler) ?? false) - handler?.Invoke(scrollView.ContentOffset.X, scrollView.ContentOffset.Y); + ScrollHandler?.Invoke(scrollView.ContentOffset.X, scrollView.ContentOffset.Y); } public override bool ShouldSelectItem(UICollectionView collectionView, NSIndexPath indexPath) diff --git a/VirtualListView/Apple/VirtualListViewHandler.ios.maccatalyst.cs b/VirtualListView/Apple/VirtualListViewHandler.ios.maccatalyst.cs index 90a5579..6879f42 100644 --- a/VirtualListView/Apple/VirtualListViewHandler.ios.maccatalyst.cs +++ b/VirtualListView/Apple/VirtualListViewHandler.ios.maccatalyst.cs @@ -62,8 +62,7 @@ protected override void ConnectHandler(UICollectionView nativeView) dataSource = new CvDataSource(this); cvdelegate = new CvDelegate(this, nativeView); - cvdelegate.ScrollHandler = new WeakReference>((x, y) => - VirtualView?.Scrolled(x, y)); + cvdelegate.ScrollHandler = (x, y) => VirtualView?.Scrolled(x, y); nativeView.DataSource = dataSource; nativeView.Delegate = cvdelegate;