Skip to content

Instantly share code, notes, and snippets.

View alikaragoz's full-sized avatar
🍉
Tap Tap Tap

Ali Karagoz alikaragoz

🍉
Tap Tap Tap
View GitHub Profile
// Defines a yet undocumented method to add a warning if super isn't called.
#ifndef NS_REQUIRES_SUPER
#if __has_attribute(objc_requires_super)
#define NS_REQUIRES_SUPER __attribute((objc_requires_super))
#else
#define NS_REQUIRES_SUPER
#endif
#endif
@interface UIViewController (SubclassingWarnings)
/**
* Several macros simplifying use of weak references to self inside blocks
* which goal is to reduce risk of retain cycles.
*
* Version 2. Uses GCC statement expressions
* instead of capturing self via block closure.
*
* Example:
* @code