I was able to solve it myself...My code looks something like this now...customPointerInteraction(on: cell.self, pointerInteractionDelegate: self)
Post
Replies
Boosts
Views
Activity
Hi,I added below print function but it doesn't print anything on mouse hover over cell...print("pointerInteraction view", interaction.view)I added the below code to cellForItemAt for CollectionViewCell, It gives me an error: Value of type 'CollectionViewCell' has no member 'view'customPointerInteraction(on: cell.view, pointerInteractionDelegate: self)
I implemented the below code from Apple Documentation:if #available(iOS 13.4, *) {
func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? {
var pointerStyle: UIPointerStyle? = nil
if let interactionView = interaction.view {
let targetedPreview = UITargetedPreview(view: interactionView)
pointerStyle = UIPointerStyle(effect: UIPointerEffect.lift(targetedPreview))
}
return pointerStyle
}
}But it is gets applied on buttons on Navigation bar but not on UICollectionViewCell...I even tried this link: owncloud.org/news/of-mice-and-mobile-devices-implementing-mouse-interaction-in-ipados-13-4/But I don't know how to apply the same hover effect on UICollectionViewCell...!!!