Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thisandagain/semver
Semantic Versioning library for Objective-C
https://github.com/thisandagain/semver
objective-c semver
Last synced: 1 day ago
JSON representation
Semantic Versioning library for Objective-C
- Host: GitHub
- URL: https://github.com/thisandagain/semver
- Owner: thisandagain
- License: mit
- Created: 2013-07-04T20:53:30.000Z (over 11 years ago)
- Default Branch: develop
- Last Pushed: 2023-07-26T15:07:05.000Z (over 1 year ago)
- Last Synced: 2025-01-01T23:08:27.355Z (8 days ago)
- Topics: objective-c, semver
- Language: Objective-C
- Homepage:
- Size: 93.8 KB
- Stars: 115
- Watchers: 6
- Forks: 52
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Semver
`EDSemver` is a helper library for Objective-C based on the 2.0.0 spec of [Semantic Versioning](http://semver.org/).### Basic Use
```objective-c
#import "EDSemver.h"
``````objective-c
EDSemver *left = [[EDSemver alloc] initWithString:@"1.2.3-foo"];
EDSemver *right = [[EDSemver alloc] initWithString:@"1.2.3"];
return [left isGreaterThan:right]; // NO
``````objective-c
EDSemver *version = [[EDSemver alloc] initWithString:@"v22.0.4-alpha+1234"];
return [version major]; // 22
```---
### Properties
```objective-c
@property (readonly) NSInteger major;
@property (readonly) NSInteger minor;
@property (readonly) NSInteger patch;
@property (readonly, nullable) NSString *prerelease;
@property (readonly, nullable) NSString *build;
```### Methods
```objective-c
+ (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](https://github.com/thisandagain/semver/tree/master/Project/semverTests) 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)](http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html), 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.