forked from shadowfacts/Tusker
Add pointer effect to search token suggestions
This commit is contained in:
parent
2f31b50a5b
commit
1b6f0c07fd
|
@ -30,6 +30,8 @@ class SearchTokenSuggestionCollectionViewCell: UICollectionViewCell {
|
||||||
label.topAnchor.constraint(equalTo: contentView.topAnchor),
|
label.topAnchor.constraint(equalTo: contentView.topAnchor),
|
||||||
label.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
|
label.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
addInteraction(UIPointerInteraction(delegate: self))
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
|
@ -40,3 +42,10 @@ class SearchTokenSuggestionCollectionViewCell: UICollectionViewCell {
|
||||||
label.text = text
|
label.text = text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension SearchTokenSuggestionCollectionViewCell: UIPointerInteractionDelegate {
|
||||||
|
func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? {
|
||||||
|
let preview = UITargetedPreview(view: self)
|
||||||
|
return UIPointerStyle(effect: .lift(preview))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue