JPAttributedStringBuilder 0.1

JPAttributedStringBuilder 0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by James Paolantonio.



A DSL for creating NSStrings and NSAttributedStrings

Installation

Install with CocoaPods:

pod 'JPAttributedStringBuilder'

Usage

NSAttributedString Creation

Have you ever had to append a bunch of NSAttributedStrings?

NSMutableAttributedString *text = [[NSMutableAttributedString alloc] init];

[text appendAttributedString:
     [[NSAttributedString alloc] initWithString:firstName
                                     attributes:@{
                                                  NSFontAttributeName : [UIFont boldSystemFont:12.0f],
                                                  NSForegroundColorAttributeName : [UIColor blackColor]
                                                  }]];

[text appendAttributedString:
     [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n", self.search.neighborhoodsString]
                                     attributes:@{
                                                  NSFontAttributeName : [UIFont proximaNovaBoldWithSize:16.0f],
                                                  NSForegroundColorAttributeName : [UIColor ucDarkColor]
                                                  }]];

[text appendAttributedString:
     [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@", self.bedPriceString]
                                     attributes:@{
                                                  NSFontAttributeName : [UIFont proximaNovaRegularWithSize:14.0f],
                                                  NSForegroundColorAttributeName : [UIColor ucDarkColor]
                                                  }]];

Examples

There is an example included with the project. To install,

$ pod install
$ open ZipLocateSample.xcworkspace/

Contribute

Send me pull requests!

Authors

James Paolantonio - @jpaolantonio

Extra

Let me know if you are using this or want anything changed!! :)