TransformerKit 0.5.4

TransformerKit 0.5.4

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

Maintained by Mattt Thompson.


Downloads

Total449,563
Week2,773
Month12,841

Installs

Apps846
Apps WeekApps This Week 57
Test Targets133
Test WeekTests This week 13
Watch Apps7
powered by Segment

GitHub

Stars765
Watchers29
Forks82
Issues0
Contributors17
Pull Requests4

Code

Files12
LOCLines of Code 657


  • By
  • Mattt Thompson

A block-based API for NSValueTransformer, with a growing collection of useful examples.

NSValueTransformer, while perhaps obscure to most iOS programmers, remains a staple of OS X development. Before Objective-C APIs got in the habit of flinging block parameters hither and thither with reckless abandon, NSValueTransformer was the go-to way to encapsulate mutation functionality--especially when it came to Bindings.

NSValueTransformer is convenient to use, but a pain to set up. Creating even a trivial value transformer required creating of its own subclass, implementing the handful of required methods, and registering a singleton instance by name.

TransformerKit breathes new life into NSValueTransformer, by making them dead-simple to define and register:

NSString * const TTTCapitalizedStringTransformerName = @"TTTCapitalizedStringTransformerName";

[NSValueTransformer registerValueTransformerWithName:TTTCapitalizedStringTransformerName
                               transformedValueClass:[NSString class]
                  returningTransformedValueWithBlock:^id(id value) {
  return [value capitalizedString];
}];

TransformerKit pairs nicely with InflectorKit & FormatterKit, providing well-designed APIs for manipulating user-facing content.


TransformerKit also contains a growing number of convenient transformers that your apps will love and cherish:

String Transformers

  • Capitalized
  • UPPERCASE
  • lowercase
  • CamelCase
  • llamaCase
  • snake_case
  • train-case
  • esreveR* (Reverse)
  • Rémövê Dîaçritics (Remove accents and combining marks)
  • ट्रांस्लितेराते स्ट्रिंग (Transliterate to Latin)
  • Any Valid ICU Transform*

Image Transformers

  • PNG Representation*
  • JPEG Representation*

Data Transformers

  • Base16 String Encode / Decode
  • Base32 String Encode / Decode
  • Base64 String Encode / Decode
  • Base85 String Encode / Decode

Date Transformers

  • ISO 8601 Timestamp*

JSON Data Transformers

  • JSON Transformer*

Cryptographic Transformers (OS X)

  • MD5, SHA-1, SHA-256, et al. Digest

* - Reversible

Contact

Mattt Thompson

License

TransformerKit is available under the MIT license. See the LICENSE file for more info.