Skip to content

Instantly share code, notes, and snippets.

@loromits
Created September 14, 2018 10:00
Show Gist options
  • Save loromits/ad67d886cd9a0b9b24cd9fb4172820e8 to your computer and use it in GitHub Desktop.
Save loromits/ad67d886cd9a0b9b24cd9fb4172820e8 to your computer and use it in GitHub Desktop.
Simple stupid Pair in Objective-C
@interface Pair<FirstType, SecondType>: NSObject
@property FirstType first;
@property SecondType second;
+ (instancetype)pairWithFirst:(FirstType)first second:(SecondType)second;
@end
@implementation Pair
+ (instancetype)pairWithFirst:(id)first second:(id)second {
__auto_type pair = [Pair new];
pair.first = first;
pair.second = second;
return pair;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment