This repository was archived by the owner on Feb 2, 2023. It is now read-only.
Add UIResponder methods to ASDisplayNode #513
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds several
UIRespondermethods toASDisplayNode, further increasing its API-compatibility withUIView. These methods include:canBecomeFirstResponderbecomeFirstRespondercanResignFirstResponderresignFirstResponderisFirstRespondercanPerformAction:withSenderThese by default just forward along to their underlying
_ASDisplayView, which should already implement them correctly. The exception to this iscanBecomeFirstResponderandcanResignFirstResponder, which by default returnNOandYES, respectively (this is so the_ASDisplayViewcan in turn ask itsASDisplayNodeif it can become the first responder without having to expose_ASDisplayViewdirectly).I put this together to make it easy to close #11. However, the work's not fully done: it's still up to implementors to actually create a copyable
ASTextNodesubclass. This is intentional - that's pretty much the state of things withUILabelas well (see nshipster.com/uimenucontroller/ for an example of how to properly subclass and implement this). If you'd like me to contribute anASCopyableTextNodeclass, I'd be happy to, although it feels a bit out-of-scope for this library.