// SDLSyncMsgVersion.m // #import "SDLSyncMsgVersion.h" #import "NSMutableDictionary+Store.h" #import "SDLNames.h" NS_ASSUME_NONNULL_BEGIN @implementation SDLSyncMsgVersion - (instancetype)initWithMajorVersion:(UInt8)majorVersion minorVersion:(UInt8)minorVersion patchVersion:(UInt8)patchVersion { self = [self init]; if (!self) { return nil; } self.majorVersion = @(majorVersion); self.minorVersion = @(minorVersion); self.patchVersion = @(patchVersion); return self; } - (void)setMajorVersion:(NSNumber *)majorVersion { [store sdl_setObject:majorVersion forName:SDLNameMajorVersion]; } - (NSNumber *)majorVersion { return [store sdl_objectForName:SDLNameMajorVersion]; } - (void)setMinorVersion:(NSNumber *)minorVersion { [store sdl_setObject:minorVersion forName:SDLNameMinorVersion]; } - (NSNumber *)minorVersion { return [store sdl_objectForName:SDLNameMinorVersion]; } - (void)setPatchVersion:(nullable NSNumber *)patchVersion { [store sdl_setObject:patchVersion forName:SDLNamePatchVersion]; } - (nullable NSNumber *)patchVersion { return [store sdl_objectForName:SDLNamePatchVersion]; } - (NSString *)description { return [NSString stringWithFormat:@"%@.%@.%@", self.majorVersion, self.minorVersion, self.patchVersion]; } @end NS_ASSUME_NONNULL_END