Swiftpack.co - twitter/TwitterTextEditor as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A standalone, flexible API that provides a full-featured rich text editor for iOS applications.
.package(url: "https://github.com/twitter/TwitterTextEditor.git", from: "1.1.2")

Twitter Text Editor

A standalone, flexible API that provides a full featured rich text editor for iOS applications.

Twitter Text Editor

This provides a robust text attribute update logic, extended text editing events, and safe text input event handling in easy delegate based APIs. TwitterTextEditor supports recent versions of iOS.


Twitter Text Editor requires macOS Catalina 10.15 or later and Xcode 11.0 and later for the development. At this moment, Twitter Text Editor supports iOS 11.0 and later also macCatalyst 13.0 and later.


Using Twitter Text Editor is straightforward if you're familiar with iOS development. See also Examples for actual usage, that contains Swift and Objective-C source code to show how to use Twitter Text Editor. See Examples/README.md as well.

Add Twitter Text Editor framework to your project

Add the following lines to your Package.swift or use Xcode “Add Package Dependency…” menu.

// In your `Package.swift`

dependencies: [
    .package(name: "TwitterTextEditor", url: "https://github.com/twitter/TwitterTextEditor", ...),
targets: [
        name: ...,
        dependencies: [
            .product(name: "TwitterTextEditor", package: "TwitterTextEditor"),

Use with other dependency management tools

In case your project is not using Swift Package Manager, you can use Twitter Text Editor with other dependency management tools.


To use Twitter Text Editor with CocoaPods, add next TwitterTextEditor.podspec in your project.

Pod::Spec.new do |spec|
  spec.name = "TwitterTextEditor"
  spec.version = "1.0.0" # Find the the version from the Git tags
  spec.authors = ""
  spec.summary = "TwitterTextEditor"
  spec.homepage = "https://github.com/twitter/TwitterTextEditor"
  spec.platform = :ios, "11.0"
  spec.source = {
    :git => "https://github.com/twitter/TwitterTextEditor.git", :tag => "#{spec.version}"
  spec.source_files  = "Sources/TwitterTextEditor/*.swift"

Then, update Podfile in your project.

pod 'TwitterTextEditor', :podspec => 'path/to/TwitterTextEditor.podspec'


To use Twitter Text Editor with Carthage, update Cartfile in your project.

github "twitter/TwitterTextEditor"

Then, run following commands. This will create Carthage/Build/iOS/TwitterTextEditor.framework.

$ carthage update
$ (cd Carthage/Checkouts/TwitterTextEditor && swift package generate-xcodeproj)
$ carthage build --platform iOS

Follow the instructions to add the framework and Run Script phase to your project.


See documentation.

Use Twitter Text Editor in your project

Twitter Text Editor provides a single view, TextEditorView, that has a similar API to UITextView and provides the most of features as a property or a delegate callback.

Add it to your project as like the other views, and setup using each property or implement delegate callbacks.

// In your view controller

import TwitterTextEditor

final class MyViewController: UIViewController {
    // ...

    override func viewDidLoad() {
        // ...
        let textEditorView = TextEditorView()
        textEditorView.text = "Meow"
        textEditorView.textAttributesDelegate = self
        // ...

    // ...

extension MyViewController: TextEditorViewTextAttributesDelegate {
    func textEditorView(_ textEditorView: TextEditorView,
                        updateAttributedString attributedString: NSAttributedString,
                        completion: @escaping (NSAttributedString?) -> Void)
        // ...


See CONTRIBUTING.md for the details.

Security issues

Please report sensitive security issues via Twitter’s bug-bounty program rather than GitHub.


Stars: 2602
Last commit: 5 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics