I want to add a peek and pop feature to my application. I managed to do it, but now I want to add support for iPhone 5s and iPhone Xr, in which there is no 3D Touch.
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if traitCollection.forceTouchCapability == .available {
registerForPreviewing(with: self, sourceView: messagesTableView)
}
}
If I understand correctly, the only way is to implement it with long press.
peek
for non 3D touch devices without implementing all action, blur, etc?You can use PeekPop framework which provide backward compatibility for Peek and Pop.
Haptic Touch can be generated via UIFeedbackGenerator subclasses.