Skip to content
Semantic Versioning library for Objective-C
Objective-C Ruby
Branch: develop
Clone or download
Latest commit 339d1ae Feb 9, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
EDSemver
Project
.gitignore Replaced gitignore with Github version Jun 10, 2016
EDSemver.podspec Update podspec Feb 9, 2017
LICENSE.md
README.md

README.md

Semver

EDSemver is a helper library for Objective-C based on the 2.0.0 spec of Semantic Versioning.

Basic Use

#import "EDSemver.h"
EDSemver *left  = [[EDSemver alloc] initWithString:@"1.2.3-foo"];
EDSemver *right = [[EDSemver alloc] initWithString:@"1.2.3"];
return [left isGreaterThan:right]; // NO
EDSemver *version  = [[EDSemver alloc] initWithString:@"v22.0.4-alpha+1234"];
return [version major]; // 22

Properties

@property (readonly) NSInteger major;
@property (readonly) NSInteger minor;
@property (readonly) NSInteger patch;
@property (readonly, nullable) NSString *prerelease;
@property (readonly, nullable) NSString *build;

Methods

+ (nonnull NSString *)spec;
+ (nonnull instancetype)semverWithString:(nonnull NSString *)aString;

- (nonnull instancetype)initWithString:(nonnull NSString *)aString;
- (NSComparisonResult)compare:(nonnull EDSemver *)aVersion;
- (BOOL)isValid;

Testing

The test suite for EDSemver is built using XCTest. To run the test suite, simply open the project in Xcode and choose "test" from the Product menu. Please run and augment the tests prior to submitting a pull request.

ARC

EDSemver is built using ARC. If you are including EDSemver in a project that does not use Automatic Reference Counting (ARC), you will need to set the -fobjc-arc compiler flag on all of the EDSemver source files. To do this in Xcode, go to your active target and select the "Build Phases" tab. Now select all EDSemver source files, press Enter, insert -fobjc-arc and then "Done" to enable ARC for EDSemver.

You can’t perform that action at this time.