CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | BSD 3.0 |
ReleasedLast Release | Nov 2016 |
SPMSupports SPM | ✗ |
Maintained by Benoit Layer.
PimpMyString is an iOS/OSX wrapper around NSAttributedStrong. It has the advantage of being strongly typed while NSStringAdditions are not.
PimpMyString.xcodeproj
to your workspace and add the appropriate framework (iOS/OSX) as a dependency of your project.Just import PMS in your source file, and call the StringTuner(s) you need. A sample code worth a thousand words (taken from the example playgrounds) :
import PMS
let string = "Hello PMS !"
let stringTuner = pms_underline(UIColor.redColor(), .StyleDouble)
>>> pms_fgColor(UIColor.purpleColor())
>>> pms_bgColor(UIColor.blackColor())
>>> pms_font(UIFont.boldSystemFontOfSize(24))
>>> pms_fgColor(UIColor.orangeColor(), range: NSMakeRange(0, 1))
>>> pms_strikeThrough(UIColor.greenColor().colorWithAlphaComponent(0.5), NSUnderlineStyle.StyleSingle)
>>> pms_skew(0.3)
>>> pms_stroke(UIColor.brownColor(), 4)
>>> pms_effectLetterPress()
let attributedString = stringTuner(NSAttributedString(string: string))
// Do whatever you want with the attributed string.
label.attributedText = attributedString
All attributes will be processed from left to right.
Initial version
PimpMyString is released under the New BSD License. See LICENSE for details.