Skip to content

Latest commit

 

History

History
94 lines (63 loc) · 2.92 KB

README.md

File metadata and controls

94 lines (63 loc) · 2.92 KB

PMS

Build Status Cocoapods Compatible Carthage compatible

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

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate PimpMyString into your Xcode project using Carthage, specify it in your Cartfile:

github "notbenoit/PimpMyString" >= 1.1.0

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To add PimpMyString to your project, add this line to your Podfile :

pod 'PimpMyString', '~> 1.1.0'

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.

Example

Ok, I'm not an artist, but whatever....

Changelog

1.0.0

Initial version

Creator

License

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