CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

PimpMyString 1.1.0

PimpMyString 1.1.0

TestsTested
LangLanguage SwiftSwift
License BSD 3.0
ReleasedLast Release Nov 2016
SPMSupports SPM

Maintained by Benoit Layer.



PMS

PimpMyString

PimpMyString is an iOS/OSX wrapper around NSAttributedStrong. It has the advantage of being strongly typed while NSStringAdditions are not.

Requirements

  • iOS 8.0+
  • OSX 10.9

Installation

Manual

  • Simply add the PimpMyString.xcodeproj to your workspace and add the appropriate framework (iOS/OSX) as a dependency of your project.
  • You can also build the framework and directly link it to your target.

Usage

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.

Changelog

1.0.0

Initial version

Creator

License

PimpMyString is released under the New BSD License. See LICENSE for details.