Latest 1.1.0
Homepage https://github.com/notbenoit/PimpMyString
License New BSD License
Platforms ios 8.0, osx 10.10, requires ARC
Authors

PMS

Build Status
Cocoapods Compatible
Carthage compatible

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.

Latest podspec

{
    "name": "PimpMyString",
    "version": "1.1.0",
    "license": "New BSD License",
    "summary": "iOS/MacOS functional wrapper around NSAttributedString.",
    "homepage": "https://github.com/notbenoit/PimpMyString",
    "social_media_url": "http://twitter.com/notbenoit",
    "authors": {
        "Benoit Layer": "[email protected]"
    },
    "source": {
        "git": "https://github.com/notbenoit/PimpMyString.git",
        "tag": "1.1.0"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "source_files": "Source/Common/*.swift",
    "ios": {
        "source_files": "Source/iOS/*.swift"
    },
    "osx": {
        "source_files": "Source/OSX/*.swift"
    },
    "requires_arc": true,
    "module_name": "PMS"
}

Pin It on Pinterest

Share This