Skip to content
No description, website, or topics provided.
Objective-C Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Version Platform

A port of the semantic version value class from the semantic Ruby gem that implements the SemVer versioning scheme.


To run the example project; clone the repo, build and run with Xcode. The sample is an iOS app that you can type two semantic version strings into and display the comparison result.

Creating a Semantic Version

The SWFSemanticVersion class parses a string in the format defined by the standard and produces an immutable value object from it. If the version string can't be parsed it returns nil.

Instances can be compared and follow the rules defined by the standard. Specifically, major > minor > patch. Pre-release < release, but two pre-release suffixes are compared lexically and numerically. Build suffixes are ignored for comparison.

For example:

  • 1.0.0 < 2.0.0 < 2.1.0 < 2.1.1
  • 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0

Create from a string (will return a nil if the string isn't parseable):

SWFSemanticVersion *semVer = [SWFSemanticVersion semanticVersionWithString:@"0.1.0"];

Or create manually:

SWFSemanticVersion *semVer = [[SWFSemanticVersion alloc] initWithMajor:@(0) minor:@(0) patch:@(0) pre:nil build:nil];


SWFSemanticVersion is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "SWFSemanticVersion"


Samuel Ford,



SWFSemanticVersion is available under the MIT license. See the LICENSE file for more info.

You can’t perform that action at this time.