Twitter announces new open source text editor API 'Twitter Text Editor' for iOS apps



Twitter has announced the ' Twitter Text Editor ', a rich text editor API for open source iOS apps. This Twitter Text Editor is the same text editor API used by Twitter for iOS, allowing non-Twitter developers to add robust text editing capabilities to their apps.

Introducing Twitter Text Editor

https://blog.twitter.com/engineering/en_us/topics/open-source/2021/introducing-twitter-text-editor.html

One of the most frequently seen actions on the app is 'text editing'. It looks like a simple text edit, but 'it can be unexpectedly complicated,' Twitter wrote. The Twitter Text Editor aims to solve common text editing problems that are difficult for developers to understand correctly, such as syntax highlighting and text content filtering.

Apple offers a high-level or low-level API set for text editing, but each has its own problems. High-level, human-friendly APIs don't always provide enough power and control to create a truly great in-app experience. Computer-friendly, low-level APIs, on the other hand, require knowledge of multilingual text editing, including bidirectional text support, input methods , and Braille keyboards.

It is said that Twitter has been working hard to deal with such problems, and it is said that the Twitter Text Editor is packed with the results. 'We hope the Twitter Text Editor will help improve the text editing experience of your app,' Twitter wrote.

The functions of Twitter Text Editor are as follows.

· Simple delegate-based API
The Twitter Text Editor is a delegate- based API, designed like many popular UIKit APIs.

· Robust text attribute update logic
The Twitter Text Editor provides a simple callback API for parsing text content and updating text attributes in the background. This allows you to implement features such as syntax highlighting.

· Additional text editing events
The Twitter Text Editor provides additional events, such as changes in the primary language that the application can use to update the UI and changes in the basic writing direction.

-Safe event processing for text input
The Twitter Text Editor provides event callbacks that are only called when it is safe for your application to filter text or update the associated user interface. Twitter explained, 'It's usually very difficult to get it right.'

・ Supports the latest version of iOS
The Twitter Text Editor supports iOS 11.0 and above, so the app is available to all iOS users.

The Twitter Text Editor also comes with sample applications written in both Swift and Objective-C. This is useful for implementing a text editor with rich editing features such as syntax highlighting.

In addition, the Twitter Text Editor is implemented as a Swift package that you can easily add to your project in Xcode. It can also be used via CocoaPods . There are no dependencies other than the iOS system framework.

The Twitter Text Editor encapsulates the UITextView and provides a familiar delegate-based API like many popular UIKit APIs. Extends LayoutManager and TextStorage to provide custom text attributes, including attributes for displaying custom emoji. The Twitter Text Editor has an event scheduler for handling events, providing your code with a consistent delegate callback order.

The figure below shows the event processing flow of the Twitter Text Editor.



Since Twitter Text Editor is an open source text editor API, the source code is published on GitHub.

GitHub --twitter / TwitterTextEditor: A standalone, flexible API that provides a full-featured rich text editor for iOS applications.
https://github.com/twitter/TwitterTextEditor



in Software, Posted by logu_ii