Skip to content

Instantly share code, notes, and snippets.

@luiseduardohdbackup
Forked from steipete/Macros.h
Created December 31, 2015 21:23
Show Gist options
  • Save luiseduardohdbackup/3a30f7ae5216143000ef to your computer and use it in GitHub Desktop.
Save luiseduardohdbackup/3a30f7ae5216143000ef to your computer and use it in GitHub Desktop.
Declare on your main init that all other init methods should call. It's a nice additional semantic warning. Works with Xcode 5.1 and above. Not tested with earlier variants, but should just be ignored. A reference to this macro shortly appeared in https://developer.apple.com/library/ios/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObj…
#ifndef NS_DESIGNATED_INITIALIZER
#if __has_attribute(objc_designated_initializer)
#define NS_DESIGNATED_INITIALIZER __attribute((objc_designated_initializer))
#else
#define NS_DESIGNATED_INITIALIZER
#endif
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment