Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 61 additions & 57 deletions EDSemver/EDSemver.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,93 +8,97 @@

#import <Foundation/Foundation.h>


/**
Semantic versioning conforming to [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html)
*/
@interface EDSemver : NSObject

/*!
* The major version number (API changes)
/**
The major version number (API changes)
*/
@property (readonly) NSInteger major;
/*!
* The minor version (functionality added in a backwards compatible manor)
/**
The minor version (functionality added in a backwards compatible manor)
*/
@property (readonly) NSInteger minor;
/*!
* The patch version (bug fixes made in a backwards compatible manor)
/**
The patch version (bug fixes made in a backwards compatible manor)
*/
@property (readonly) NSInteger patch;
/*!
* The prerelease number, preceded with -, e.g. 1.2.3-alpha1
/**
The prerelease number, preceded with -, e.g. 1.2.3-alpha1
*/
@property (readonly, nullable) NSString *prerelease;
/*!
* The build number, preceded with +, e.g. 1.2.3+456
/**
The build number, preceded with +, e.g. 1.2.3+456
*/
@property (readonly, nullable) NSString *build;

/*!
* The current semver spec version
*
* @return The spec version as a string
/**
The current semver spec version

@return The spec version as a string
*/
+ (nonnull NSString *)spec;
/*!
* Create a semver object with a version string
*
* @param aString The version string
*
* @return The semver object
/**
Create a semver object with a version string

@param aString The version string

@return The semver object
*/
+ (nonnull instancetype)semverWithString:(nonnull NSString *)aString;

/*!
* Create a semver object with a version string
*
* @param aString The version string
*
* @return The semver object
/**
Create a semver object with a version string

@param aString The version string

@return The semver object
*/
- (nonnull instancetype)initWithString:(nonnull NSString *)aString;

/*!
* Compare semver objects
*
* @param aVersion The version string
*
* @return The semver object
/**
Compare semver objects

@param aVersion The version string

@return The semver object
*/
- (NSComparisonResult)compare:(nonnull EDSemver *)aVersion;
/*!
* Is version equal to another version
* Implemented using `compare:`. Returns NO parameter is nil
*
* @param object Another version
*
* @return YES if equal, NO otherwise
/**
Is version equal to another version
Implemented using `compare:`. Returns `NO` if parameter is `nil`

@param object Another version

@return `YES` if equal, `NO` otherwise
*/
- (BOOL)isEqualTo:(nullable id)object;
/*!
* Is version less than another version.
* Implemented using `compare:`. Returns NO parameter is nil
*
* @param object Another version
*
* @return YES if less than, NO otherwise
/**
Is version less than another version.
Implemented using `compare:`. Returns `NO` if parameter is `nil`

@param object Another version

@return `YES` if less than, `NO` otherwise
*/
- (BOOL)isLessThan:(nullable id)object;
/*!
* Is version greater than than another version.
* Implemented using `compare:`. Returns NO parameter is nil
*
* @param object Another version
*
* @return YES if greater than, NO otherwise
/**
Is version greater than than another version.
Implemented using `compare:`. Returns `NO` if parameter is `nil`

@param object Another version

@return `YES` if greater than, `NO` otherwise
*/
- (BOOL)isGreaterThan:(nullable id)object;

/*!
* Is the semver object valid?
*
* @return YES if valid, NO otherwise
/**
Is the semver object valid?

@return `YES` if valid, `NO` otherwise
*/
- (BOOL)isValid;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down