Skip to content

muukii/TextAttributesUtil

Repository files navigation

TextAttributesUtil

CI Status Version License Platform Carthage compatible

Quickly create NSAttributedString with TextAttributes

Usage

Before

let attributes = TextAttributes()
                    .font(UIFont.systemFontOfSize(14))
                    .alignment(.Center)
                    .foregroundColor(UIColor(white: 0.7, alpha: 1))

let attributedText = NSAttributedString(string: "Hello, NSAttributedText", attributes: attributes)

After

let attributedText = "Hello, NSAttributedText"
    .attributed {
        TextAttributes()
            .font(UIFont.systemFontOfSize(14))
            .alignment(.Center)
            .foregroundColor(UIColor(white: 0.7, alpha: 1))
    }

Installation

TextAttributesUtil is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TextAttributesUtil"

Author

muukii, m@muukii.me

License

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

About

Quickly create NSAttributedString with TextAttributes

Resources

License

Stars

Watchers

Forks

Packages

No packages published