Swiftgram/Classes/BITBase.m
2015-08-31 19:32:37 -07:00

36 lines
835 B
Objective-C

#import "BITBase.h"
#import "BITOrderedDictionary.h"
/// Data contract class for type Base.
@implementation BITBase
///
/// Adds all members of this class to a dictionary
/// @param dictionary to which the members of this class will be added.
///
- (BITOrderedDictionary *)serializeToDictionary {
BITOrderedDictionary *dict = [super serializeToDictionary];
if (self.baseType != nil) {
[dict setObject:self.baseType forKey:@"baseType"];
}
return dict;
}
#pragma mark - NSCoding
- (instancetype)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder:coder];
if(self) {
_baseType = [coder decodeObjectForKey:@"self.baseType"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder {
[super encodeWithCoder:coder];
[coder encodeObject:self.baseType forKey:@"self.baseType"];
}
@end