Skip to content

Instantly share code, notes, and snippets.

@fatihemreozkul
fatihemreozkul / NSObject+PropertyName.h
Created June 25, 2017 17:06 — forked from xareelee/NSObject+PropertyName.h
Objective-C property name to a string with autocompletion and compile-time check
// Release under MIT
// Copyright (C) 2015 Xaree Lee
#import <Foundation/Foundation.h>
/* Get property name for the class (C string or NSSting). */
#define keypathForClass(Klass, PropertyName) \
(((void)(NO && ((void)[Klass _nullObjectForCheckingPropertyName].PropertyName, NO)), # PropertyName))
#define keypathStringForClass(Klass, PropertyName) \
@keypathForClass(Klass, PropertyName)