Latest 1.1.0
License MIT
Platforms ios 4.0, osx 10.6, requires ARC
Frameworks Foundation

Build Status
Build Status

Stop using constant NSStrings to represent your keypaths: use compiler symbols instead.


Super simple extension to Justin Spahr-Summers’ object key path validation macro that adds a macro for validating key paths without requiring an instance of the class.

Particularly useful for removing constant NSStrings from your API mappings.


  • JCValidateKeyPath(anObject, aKeyPath)

    • The original macro. Validates the specified key path as a compiler symbol and returns an equivalent NSString representation.
  • JCValidateKeyPathWithClass(aClass, aKeyPath)
    • As an extension of the above, does not require an object instance, and can use a Class directly.


// With a local instance
NSString *stringInstance = nil;
JCValidateKeyPath(stringInstance, length);

// Without a local instance
JCValidateKeyPathWithClass(NSString, length)

Note that as of v1.0.1 you cannot use JCValidateKeyPathWithClass([NSString class], length). Instead you must use the class symbol directly.

Version history


Cache now removed and functionality entirely implemented with macros. Many thanks to Stepan Hruda for this.


General spring-clean and Travis configuration.


Now casting the object returned from the cache. Without this, class validation wasn’t actually correctly working; you could use any valid selector from any class.


Initial release.

Have fun!

MIT Licensed >> [email protected]

Latest podspec

    "name": "JCKeyPathValidator",
    "version": "1.1.0",
    "summary": "Compiler keypath validation.",
    "description": "Stop using constant NSStrings to represent your keypaths: use compiler symbols instead.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Jonathan Crooke": "[email protected]"
    "source": {
        "git": "",
        "tag": "v1.1.0"
    "platforms": {
        "ios": "4.0",
        "osx": "10.6"
    "source_files": "JCKeyPathValidation/*.{h,m}",
    "frameworks": "Foundation",
    "requires_arc": true

Pin It on Pinterest

Share This