str

StringAttribute

StringAttribute is simple to write about NSAttributedString

Showing:

Popularity

Downloads/wk

0

GitHub Stars

40

Maintenance

Last Commit

9mos ago

Contributors

3

Package

Dependencies

0

License

MIT

Categories

Readme

StringAttribute

StringAttribute is simple to write about NSAttributedString.

Usage

You can write like the one below.

  • Initialize attributed string
 "Hello, world".attributed() // NSAttributedString
  • Attach attributes with method chain
label.attributedText = "Hello, world".attributed()
    .apply(with: .foregroundColor(.white)) // All text to be white color
    .apply(with: .foregroundColor(.blue), in: 0..<5) // "Hello" to be blue color
    .apply(with: [.font(UIFont.boldSystemFont(ofSize: 20)), .foregroundColor(.red)], for: "world") // "world" is to be Bold font and red color
  • Attach paragraph style with method chain
label.attributedText = "Hello, \nworld".attributed()
    .apply(with: .paragraph(.complex([.alignment(.center), .lineSpacing(20)]))) // All line text alignment is center and line space is 20.
    .apply(with: .paragraph(.firstLineHeadIndent(20)), for: "world")  // Containing "world", the head indent of line is 20px

TODO

  • Write test
  • Add demo project
  • Add playground sample
  • CocoaPods
  • Carthage

License

StringAttribute is available under the MIT license. See the LICENSE file for more info.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100