Sitemap

Texts With Multiple Colors iOS

1 min readMar 8, 2018

--

We would be implementing MutableString to help with providing texts with multiple colors for our Widgets

Get ابوبخر اولاديجي ✪’s stories in your inbox

Join Medium for free to get updates from this writer.

This is all we need:

let minAttr = NSMutableAttributedString(string: {text})minAttr.addAttribute(NSAttributedStringKey.foregroundColor, value: , {color} range: NSMakeRange(0, minAttr.length))attributedText.append(minAttr)

Providing an extension that handles multiple text coloring at a time

Usage:

Result:

--

--