DEV Community

Cover image for How to Build Rich Text Editor in SwiftUI
divyesh vekariya
divyesh vekariya

Posted on

How to Build Rich Text Editor in SwiftUI

Building a Rich Text Editor in SwiftUI (with iOS 26 APIs)

I am spending weekends exploring new iOS features — and this time, I went deep into the latest SwiftUI text APIs in iOS 26. The goal? To build a fully native Rich Text Editor — no UIKit, no hacks, just clean SwiftUI.

Apple’s new text stack has evolved a lot — with AttributedString, AttributedTextSelection, and transformAttributes(in:), it’s finally possible to manage styles like bold, italic, and underline directly in SwiftUI while keeping everything performant and elegant.

In my full article, I dive into how to:
✅ Build toolbar actions for bold, italic, underline
✅ Keep toolbar state synced with selection
✅ Handle serialization for saving styled text

It’s amazing how much cleaner things have become with the new APIs — definitely one of my favorite updates in iOS 26.

Check out the full write-up here: https://medium.com/@dkvekariya/how-to-build-rich-text-editor-in-swiftui-f09a39d2dce9

Top comments (0)