Skip to content

Instantly share code, notes, and snippets.

View CraigSiemens's full-sized avatar

Craig Siemens CraigSiemens

View GitHub Profile
@CraigSiemens
CraigSiemens / iflet.m
Last active May 2, 2021 02:09 — forked from jspahrsummers/iflet.m
if-let and guard macros for Objective C
#import <Foundation/Foundation.h>
// VARIABLE must be a variable declaration (NSString *foo)
// VALUE is what you are checking is not nil
// WHERE is an additional BOOL condition
#define iflet(VARIABLE, VALUE) \
ifletwhere(VARIABLE, VALUE, YES)
#define ifletwhere(VARIABLE, VALUE, WHERE) \