Skip to content

Instantly share code, notes, and snippets.

@hborders
Last active March 13, 2017 16:26
Show Gist options
  • Save hborders/12fcbe34cf4de68c2317bad92a8e223d to your computer and use it in GitHub Desktop.
Save hborders/12fcbe34cf4de68c2317bad92a8e223d to your computer and use it in GitHub Desktop.
An Objective-C pattern for making sum types - ExamplePrivate.h
#import "Example.h" // https://gist.github.com/hborders/e00d7ff965ca8f8df8f7e762a2269efb
#import "ExampleFoo.h" // https://gist.github.com/hborders/094f05d932b3d7a1e389184ba525b0c3
#import "ExampleBar.h" // https://gist.github.com/hborders/f1c231a89de11157adf46ee85880733a
@interface Example ()
- (instancetype _Nonnull)initPrivate NS_DESIGNATED_INITIALIZER;
@end
@interface ExampleFoo()
- (instancetype _Nonnull)initPrivate NS_UNAVAILABLE;
@end
@interface ExampleBar()
- (instancetype _Nonnull)initPrivate NS_UNAVAILABLE;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment