Inherits from | PBSemanticVersion : NSObject |
Conforms to | NSCopying |
Declared in | PBFirmwareVersion.h |
Overview
PBFirmwareVersion is a helper class that is able to parse the versionTag string into its components (major, minor, revision, suffix) and facilitate comparisons between versions.
Valid versions follow the following format:
(v)MAJORVERSION(.MINORVERSION(.REVISIONVERSION(-SUFFIX)))
Where the fields MAJOR, MINOR, REVISION are positive, decimal integer numbers and SUFFIX an arbitrary string. MINOR, REVISION, and SUFFIX are optional (nested optionality).
Examples of valid versions:
1
v2
v3.4-foo
v4.1234.99-alpha-beta-gamma
Note: For legacy uses in which the legacy properties below are used, the version format is:
(v)OS(.MAJOR(.MINOR(-SUFFIX)))
Other Methods
commitHash
The version’s git commit hash.
@property (nonatomic, readonly, copy, nullable) NSString *commitHash
Discussion
The commit hash is not used in the -compare: method.
Declared In
PBFirmwareVersion.h
tag
The version’s git tag.
@property (nonatomic, readonly, copy) NSString *tag
Declared In
PBFirmwareVersion.h
+ firmwareVersionWithString:
Creates a PBFirmwareVersion object given a tag string.
+ (nullable instancetype)firmwareVersionWithString:(NSString *)tag
Parameters
- tag
- The firmware version string to parse.
Declared In
PBFirmwareVersion.h
+ firmwareVersionWithTag:commitHash:timestamp:
+ (nullable instancetype)firmwareVersionWithTag:(NSString *)tag commitHash:(nullable NSString *)commitHash timestamp:(uint32_t)timestamp
Parameters
- tag
- The firmare version string to parse.
- commitHash
- A version’s commit hash. Can be nil.
- timestamp
- The version timestamp.
Declared In
PBFirmwareVersion.h
+ firmwareVersionWithMajor:minor:revision:suffix:commitHash:timestamp:
Creates a PBFirmwareVersion object given its components.
+ (instancetype)firmwareVersionWithMajor:(NSInteger)major minor:(NSInteger)minor revision:(NSInteger)revision suffix:(nullable NSString *)suffix commitHash:(nullable NSString *)commitHash timestamp:(uint32_t)timestamp
Parameters
- major
- The version major number.
- minor
- The version minor number.
- revision
- The version revision number.
- suffix
- The version suffix. Can be nil.
- commitHash
- A version’s commit hash. Can be nil.
- timestamp
- The version timestamp.
Discussion
The tag string will be set to the canonical format vMAJOR.MINOR.REVISION(-SUFFIX).
Declared In
PBFirmwareVersion.h
Legacy Methods
os
The OS version component. (Deprecated: Use [PBSemanticVersion majorVersion])
@property (nonatomic, readonly) NSInteger os
Declared In
PBFirmwareVersion+Legacy.h
major
The major version component. (Deprecated: Use [PBSemanticVersion minorVersion])
@property (nonatomic, readonly) NSInteger major
Discussion
Note: If a version tag string does not contain a major component, it will be set to 0.
Declared In
PBFirmwareVersion+Legacy.h
+ firmwareVersionWithOS:major:minor:suffix:commitHash:timestamp:
Creates a PBFirmwareVersion object given its components. (Deprecated: Use +[PBFirmwareVersion firmwareVersionWithMajor:minor:revision:suffix:commitHash:timestamp:])
+ (nullable instancetype)firmwareVersionWithOS:(NSInteger)os major:(NSInteger)major minor:(NSInteger)minor suffix:(nullable NSString *)suffix commitHash:(nullable NSString *)commitHash timestamp:(uint32_t)timestamp
Parameters
- os
- The version major number.
- major
- The version minor number.
- minor
- The version revision number.
- suffix
- The version suffix. Can be nil.
- commitHash
- A version’s commit hash. Can be nil.
- timestamp
- The version timestamp.
Discussion
The tag string will be set to the canonical format vMAJOR.MINOR.REVISION(-SUFFIX).
Declared In
PBFirmwareVersion+Legacy.h