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.

Properties

build

The build number

@property (nonatomic, readonly) NSUInteger build

Declared In

DTVersion.h

maintenance

The maintenance/hotfix version number

@property (nonatomic, readonly) NSUInteger maintenance

Declared In

DTVersion.h

major

The major version number

@property (nonatomic, readonly) NSUInteger major

Declared In

DTVersion.h

minor

The minor version number

@property (nonatomic, readonly) NSUInteger minor

Declared In

DTVersion.h

Class Methods

appBundleVersion

creates and retuns a DTVersion object initialized with the version information of the current application

+ (DTVersion *)appBundleVersion

Return Value

A DTVersion object or nil if the string of the current application is not a valid version number

Declared In

DTVersion.h

osVersion

creates and retuns a DTVersion object initialized with the version information of the operating system

+ (DTVersion *)osVersion

Return Value

A DTVersion object or nil if the string of the current application is not a valid version number

Declared In

DTVersion.h

osVersionIsGreaterThen:

The OS version as NSString to compare the receiver to

+ (BOOL)osVersionIsGreaterThen:(NSString *)versionString

Parameters

versionString

The OS version as NSString to compare the receiver to

Return Value

true if the given version string is valid and greater then the osVersion

Declared In

DTVersion.h

osVersionIsLessThen:

The OS version as NSString to compare the receiver to

+ (BOOL)osVersionIsLessThen:(NSString *)versionString

Parameters

versionString

The OS version as NSString to compare the receiver to

Return Value

true if the given version string is valid and less then the osVersion

Declared In

DTVersion.h

versionWithString:

creates and returns a DTVersion object initialized using the provided string

+ (DTVersion *)versionWithString:(NSString *)versionString

Parameters

versionString

The NSString to create a DTVersion from

Return Value

A DTVersion object or nil if the string is not a valid version number

Declared In

DTVersion.h

Instance Methods

compare:

Compares the receiver against a passed DTVersion instance

- (NSComparisonResult)compare:(DTVersion *)version

Parameters

version

The DTVersion to compare the receiver to

Return Value

The comparison result

Declared In

DTVersion.h

initWithMajor:minor:maintenance:

Initializes the receiver with major, minor and maintenance version.

- (DTVersion *)initWithMajor:(NSUInteger)major minor:(NSUInteger)minor maintenance:(NSUInteger)maintenance

Parameters

major

The major version number

minor

The minor version number

maintenance

The maintainance/hotfix version number

Return Value

The initialized DTVersion

Declared In

DTVersion.h

initWithMajor:minor:maintenance:build:

Initializes the receiver with major, minor and maintenance version.

- (DTVersion *)initWithMajor:(NSUInteger)major minor:(NSUInteger)minor maintenance:(NSUInteger)maintenance build:(NSUInteger)build

Parameters

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.h

isEqual:

Compares the receiver against a passed object

- (BOOL)isEqual:(id)object

Parameters

object

An object of either NSString or DTVersion

Return Value

YES is the versions are equal

Declared In

DTVersion.h

isEqualToString:

Compares the receiver against a passed version as NSString

- (BOOL)isEqualToString:(NSString *)versionString

Parameters

versionString

The version as NSString to compare the receiver to

Return Value

YES is the versions are equal

Declared In

DTVersion.h

isEqualToVersion:

Compares the receiver against a passed DTVersion instance

- (BOOL)isEqualToVersion:(DTVersion *)version

Parameters

version

The DTVersion to compare the receiver to

Return Value

YES is the versions are equal

Declared In

DTVersion.h

isGreaterThenVersion:

The DTVersion to compare the receiver to

- (BOOL)isGreaterThenVersion:(DTVersion *)version

Parameters

version

The DTVersion to compare the receiver to

Return Value

true if the give version is greater then this version

Declared In

DTVersion.h

isGreaterThenVersionString:

The version as NSString to compare the receiver to * @returns true if the give version is greater then version string

- (BOOL)isGreaterThenVersionString:(NSString *)versionString

Parameters

versionString

The version as NSString to compare the receiver to * @returns true if the give version is greater then version string

Declared In

DTVersion.h

isLessThenVersion:

The DTVersion to compare the receiver to

- (BOOL)isLessThenVersion:(DTVersion *)version

Parameters

version

The DTVersion to compare the receiver to

Return Value

true if the give version is less then this version

Declared In

DTVersion.h

isLessThenVersionString:

The version as NSString to compare the receiver to

- (BOOL)isLessThenVersionString:(NSString *)versionString

Parameters

versionString

The version as NSString to compare the receiver to

Return Value

true if the give version is less then this version string

Declared In

DTVersion.h