Last active
August 29, 2015 14:22
-
-
Save cspickert/5532ac44bc608422628a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface Box<__covariant T: __kindof NSObject *> : NSObject | |
@property (nonatomic, readonly) __nonnull T value; | |
- (nonnull instancetype)initWithValue:(nonnull T)value; | |
@end | |
@interface Box<T: __kindof NSObject *> () | |
@property (nonatomic) T value; | |
@end | |
@implementation Box | |
@synthesize value = _value; | |
- (instancetype)initWithValue:(__kindof NSObject *)value | |
{ | |
if ((self = [super init])) { | |
self.value = value; | |
} | |
return self; | |
} | |
- (NSString *)description | |
{ | |
return [NSString stringWithFormat:@"Box{%@}", self.value.description]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment