@knutknatter @lextar @simonbs @steveshepard I think I have mostly repressed it
Hah but yeah it was ok — a lot of little details to copy from iOS. I did the selection / loupe / handle rendering too
@lextar @knutknatter @steveshepard @simsaens I believe I have a fix for the caret not appearing on iOS 17 when using UITextInteraction.
The issue seems to be that the UITextSelectionDisplayInteraction that's automatically created when using UITextInteraction isn't activated when the editable text interaction is added to the view. Manually activating it resolves the issue.
Unfortunately, this uses a bit of private API 🤷♂️
You can see my workaround is here: https://github.com/simonbs/Runestone/pull/314
This works around an issue where the caret does not appear when editing starts on iOS 17 until the user have tapped the text view again. This is a regression in UITextInteraction and other develope...
@knutknatter @steveshepard The "What's new with text and text interactions" session from WWDC seems to suggest that using UITextInteraction is still preferred.
On adopting the redesigned UI of the caret and text selection, the engineer says “If you have a highly customized UI for displaying text, it can be challenging to keep up with these changes in your own implementation, especially if you aren't able to adopt UITextInteraction”.
@knutknatter @steveshepard I've just made a quick test with UITextSelectionDisplayInteraction and with the new API I'm no longer seeing the bug where the text selection handles are placed incorrectly on visionOS: https://mastodon.social/@simonbs/110903512345493534
So Apple is suggesting that UITextInteraction is preferred but it's exhibiting bugs that UITextSelectionDisplayInteraction isn't. Now, I have yet to discover which bugs UITextSelectionDisplayInteraction exhibits 😄
@simonbs @knutknatter Are you providing a selection container? If not, this might help:
- (nullable UIView *)selectionContainerViewBelowTextForSelectionDisplayInteraction:(UITextSelectionDisplayInteraction *)interaction;
@simonbs @knutknatter The interaction also tests for the private vars "selectionContainerView" and "_selectionContainerViewAboveText". Worth a try?
Per the earlier discussion, note also the "becomesEditableWithGestures" and "playsNicelyWithGestures" private vars. It looks like there is a rats nest of compatibility code in UITextInteraction. I feel bad for James.
@amyworrall @knutknatter @steveshepard At the moment they only seem to provide a foreground color, at least when supplying the inline prediction. The color is always UIColor.systemGray, so I'm discarding it as that's not guaranteed to be readable.
I'm suggesting they should supply an attributed string with an attribute that indicates why the text should be marked.