Skip to content

Instantly share code, notes, and snippets.

@khanlou khanlou/HTTPMethod.h
Last active Aug 22, 2018

Embed
What would you like to do?
@interface HTTPMethod: NSString
+ (HTTPMethod *)GET;
+ (HTTPMethod *)POST;
@end
@interface HTTPMethod()
@property NSString *name;
@end
@implementation HTTPMethod
+ (HTTPMethod *)GET {
return [[HTTPMethod alloc] initWithName:@"GET"];
}
+ (HTTPMethod *)POST {
return [[HTTPMethod alloc] initWithName:@"POST"];
}
- (instancetype)initWithName:(NSString *)name {
self = [super init];
if (!self) return nil;
_name = name;
return self;
}
- (NSUInteger)length {
return self.name.length;
}
- (unichar)characterAtIndex:(NSUInteger)index {
return [self.name characterAtIndex:index];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.