EDSemver 0.4.0

EDSemver 0.4.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Feb 2017

Maintained by Andrew Sliwinski.



EDSemver 0.4.0

  • By
  • Andrew Sliwinski, Sam Soffes and Delisa Mason

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.