DTVersion Class Reference
| Inherits from | NSObject |
| Declared in | DTVersion.h |
Overview
Class that represents a version number comprised of major, minor and maintenance number separated by dots. For example “1.2.2”.
This encapsulation simplifies comparing versions against each other. Sub-numbers that are omitted on creating a DTVersion are assumed to be 0.
Tasks
Properties
-
majorproperty -
minorproperty -
maintenanceproperty -
buildproperty
Creating Versions
-
– initWithMajor:minor:maintenance: -
– initWithMajor:minor:maintenance:build: -
+ versionWithString: -
+ appBundleVersion -
+ osVersion
Comparing Versions
Properties
maintenance
The maintenance/hotfix version number
@property (nonatomic, readonly) NSUInteger maintenanceDeclared In
DTVersion.hClass Methods
appBundleVersion
creates and retuns a DTVersion object initialized with the version information of the current application
+ (DTVersion *)appBundleVersionReturn Value
A DTVersion object or nil if the string of the current application is not a valid version number
Declared In
DTVersion.hosVersion
creates and retuns a DTVersion object initialized with the version information of the operating system
+ (DTVersion *)osVersionReturn Value
A DTVersion object or nil if the string of the current application is not a valid version number
Declared In
DTVersion.hosVersionIsGreaterThen:
The OS version as NSString to compare the receiver to
+ (BOOL)osVersionIsGreaterThen:(NSString *)versionStringParameters
- versionString
The OS version as
NSStringto compare the receiver to
Return Value
true if the given version string is valid and greater then the osVersion
Declared In
DTVersion.hosVersionIsLessThen:
The OS version as NSString to compare the receiver to
+ (BOOL)osVersionIsLessThen:(NSString *)versionStringParameters
- versionString
The OS version as
NSStringto compare the receiver to
Return Value
true if the given version string is valid and less then the osVersion
Declared In
DTVersion.hversionWithString:
creates and returns a DTVersion object initialized using the provided string
+ (DTVersion *)versionWithString:(NSString *)versionStringParameters
- versionString
The
NSStringto create aDTVersionfrom
Return Value
A DTVersion object or nil if the string is not a valid version number
Declared In
DTVersion.hInstance Methods
compare:
Compares the receiver against a passed DTVersion instance
- (NSComparisonResult)compare:(DTVersion *)versionParameters
- version
The
DTVersionto compare the receiver to
Return Value
The comparison result
Declared In
DTVersion.hinitWithMajor:minor:maintenance:
Initializes the receiver with major, minor and maintenance version.
- (DTVersion *)initWithMajor:(NSUInteger)major minor:(NSUInteger)minor maintenance:(NSUInteger)maintenanceParameters
- major
The major version number
- minor
The minor version number
- maintenance
The maintainance/hotfix version number
Return Value
The initialized DTVersion
Declared In
DTVersion.hinitWithMajor:minor:maintenance:build:
Initializes the receiver with major, minor and maintenance version.
- (DTVersion *)initWithMajor:(NSUInteger)major minor:(NSUInteger)minor maintenance:(NSUInteger)maintenance build:(NSUInteger)buildParameters
- major
The major version number
- minor
The minor version number
- maintenance
The maintainance/hotfix version number
- build
The build number
Return Value
The initialized DTVersion
Declared In
DTVersion.hisEqual:
Compares the receiver against a passed object
- (BOOL)isEqual:(id)objectParameters
- object
An object of either
NSStringorDTVersion
Return Value
YES is the versions are equal
Declared In
DTVersion.hisEqualToString:
Compares the receiver against a passed version as NSString
- (BOOL)isEqualToString:(NSString *)versionStringParameters
- versionString
The version as
NSStringto compare the receiver to
Return Value
YES is the versions are equal
Declared In
DTVersion.hisEqualToVersion:
Compares the receiver against a passed DTVersion instance
- (BOOL)isEqualToVersion:(DTVersion *)versionParameters
- version
The
DTVersionto compare the receiver to
Return Value
YES is the versions are equal
Declared In
DTVersion.hisGreaterThenVersion:
The DTVersion to compare the receiver to
- (BOOL)isGreaterThenVersion:(DTVersion *)versionParameters
- version
The
DTVersionto compare the receiver to
Return Value
true if the give version is greater then this version
Declared In
DTVersion.hisGreaterThenVersionString:
The version as NSString to compare the receiver to
* @returns true if the give version is greater then version string
- (BOOL)isGreaterThenVersionString:(NSString *)versionStringParameters
- versionString
The version as
NSStringto compare the receiver to * @returnstrueif the give version is greater then version string
Declared In
DTVersion.hisLessThenVersion:
The DTVersion to compare the receiver to
- (BOOL)isLessThenVersion:(DTVersion *)versionParameters
- version
The
DTVersionto compare the receiver to
Return Value
true if the give version is less then this version
Declared In
DTVersion.hisLessThenVersionString:
The version as NSString to compare the receiver to
- (BOOL)isLessThenVersionString:(NSString *)versionStringParameters
- versionString
The version as
NSStringto compare the receiver to
Return Value
true if the give version is less then this version string
Declared In
DTVersion.h