Mastodon Rich Editor | My Portfolio

Rich Editor

Developed in 2020 | Just Me

Project Briefing

RichEditor is a WYSIWYG editor written in pure Swift. RichEditor is a direct subclass of NSTextView so you’ll feel perfectly comfortable using it.

If you are developing a macOS application that uses an NSTextView and you want your users to be able to format their text, you are forced to use the usesInspectorBar property, which adds a formatting toolbar to your NSTextView.

However if you want to modify the UI or modify functionality at all, you’ll soon find a dead-end. This is where RichEditor comes in.

Just drag RichEditor into your UI, and you can use RichEditors functionality to easily programatically control which parts of your text are formatted and how. From bolding and underlining to text alignment and text colour, you have control over your text view. You can create your own UI the way you want and connect your UI to the RichEditor functionality.

However if you want to use a template UI, RichEditor has one last trick up its sleeve for you. Simply call the configureToolbar() from your instance of RichEditor and you will have our pre-made toolbar ready to go!

RichEditor also handles the difficult logic of handling text formatting when a user has already highlighted a piece of text, or when you want to export the text with HTML formatting.

RichEditor allows you to control:

  • Bolding
  • Italics
  • Underlining
  • Font Selection
  • Font Size Selection
  • Text Alignment (Left, Centre, Right, Justified)
  • Text Colour
  • Text Highlight Colour
  • Link Insertion
  • Bullet Points
  • Text Strikethrough
  • Attachment Insertion



Technical Details

  • RichEditor uses Swift 5 and AppKit, and runs for the macOS platform.
  • The RichEditor project uses the MIT licence, and is hosted on Github.
  • RichEditor supports CocoaPods, Carthage and Swift Package Manager.
  • RichEditor uses unit tests in conjunction with Github Actions to ensure consistent code quality is maintained.