From 1b6f0c07fdeabb323b813d45d7053852cb7b29bc Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 8 Jun 2024 11:26:10 -0700 Subject: [PATCH] Add pointer effect to search token suggestions --- .../Search/SearchTokenSuggestionCollectionViewCell.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tusker/Screens/Search/SearchTokenSuggestionCollectionViewCell.swift b/Tusker/Screens/Search/SearchTokenSuggestionCollectionViewCell.swift index 9bd94f84..cc659fe5 100644 --- a/Tusker/Screens/Search/SearchTokenSuggestionCollectionViewCell.swift +++ b/Tusker/Screens/Search/SearchTokenSuggestionCollectionViewCell.swift @@ -30,6 +30,8 @@ class SearchTokenSuggestionCollectionViewCell: UICollectionViewCell { label.topAnchor.constraint(equalTo: contentView.topAnchor), label.bottomAnchor.constraint(equalTo: contentView.bottomAnchor) ]) + + addInteraction(UIPointerInteraction(delegate: self)) } required init?(coder: NSCoder) { @@ -40,3 +42,10 @@ class SearchTokenSuggestionCollectionViewCell: UICollectionViewCell { label.text = text } } + +extension SearchTokenSuggestionCollectionViewCell: UIPointerInteractionDelegate { + func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? { + let preview = UITargetedPreview(view: self) + return UIPointerStyle(effect: .lift(preview)) + } +}