zacwest / ZSWTappableLabel

UILabel subclass for links which are tappable, long-pressable, 3D Touchable, and VoiceOverable.
MIT License
169 stars 37 forks source link

Provide support for 3D Touch #19

Closed zacwest closed 5 years ago

zacwest commented 8 years ago

I believe the API just gives you a CGPoint so we may need to provide a public getter for the attributes at a point like the -gestureRecognizerShouldBegin: uses.

Need to make sure the gesture recognizers aren't firing at the same time, so we don't smash state around, since they explicitly depend on the UIGR flow for whether the NSLayoutManager & cousins live.

phillebaba commented 8 years ago

A solution would be to expand the existing delegate methods to forward the UITouch methods, which would be called before the tap completes.

zacwest commented 8 years ago

I think the problem there is the API for 3D Touch is:

func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController?

The UIViewController is queried at time of interest with "what's the UIViewController I should present for this point?" It would probably be pretty complicated to make the delegates keep track of state for this.