Twitter announced today a new “standalone, flexible” open source API for iOS developers that provides a text editor for apps, which is the same used as the basis for tweet and Fleet composer on the Twitter app for iOS.
The announcement was made today through the official Twitter blog. The company says it knows how complicated it can be to implement a simple text editor in iOS apps during the development process, so that’s why Twitter is now making its own Text Editor API available to everyone.
According to Twitter, the new Text Editor API solves common problems related to syntax highlighting and text content filtering. The company claims that Apple offers multiple text editing APIs for developers, but they can be very limited or too complicated to understand — which is something the new Twitter API aims to solve.
The high-level APIs don’t always offer enough power or control to create a truly great in-app experience. Meanwhile, the lower level APIs require a lot of knowledge about how text editing works in a variety of languages, including support for bidirectional scripts, alternative input methods (like those used for East Asian languages), and assistive technology like braille keyboards.
Developers will find robust text-attribute update logic, additional text editing events, safe event handling for text input, and support for recent versions of iOS with Twitter’s Text Editor API. It’s implemented as a Swift Package that can be easily added to an Xcode project, besides working with CocoaPods.
Twitter Text Editor encapsulates UITextView and provides familiar delegate-based APIs like many common UIKit APIs. It extends LayoutManager and TextStorage to provide custom text attributes, including attributes for presenting custom emoji. Twitter Text Editor has event schedulers to process events, providing consistent delegate callback order to your code.
The new open source Twitter Text Editor API can be found for free on GitHub. It works with iOS 11 or later and requires Xcode 11 or later for development.
Author: Filipe Espósito
Source: 9TO5Google