🤖

よく使うdefine

2021/12/29に公開
defines.h
#define SYNTHESIZE(_X_) @synthesize _X_ = _X_##_;
#define RELEASE_SAFELY(__POINTER) { [__POINTER release]; __POINTER = nil; }
#define CFRELEASE_SAFELY(__POINTER) { if (__POINTER) { CFRelease(__POINTER); __POINTER = NULL; } }
#define L(__STR) NSLocalizedString(__STR, @"")

#ifdef DEBUG
  #define LOG(...) NSLog(__VA_ARGS__)
  #define LOG_METHOD NSLog(@"%s", __func__)
  #define LOG_CURRENT_METHOD NSLog(@"%@/%@", NSStringFromClass([self class]), NSStringFromSelector(_cmd))
#else
  #define LOG(...)
  #define LOG_METHOD
  #define LOG_CURRENT_METHOD
#endif

Discussion