Latest 1.0.3
License MIT
Platforms ios 9.0

CI Status


To run the example project, clone the repo, and run pod install from the Example directory first.


Written in Swift 3. Requires iOS 9 (deployment target).


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

pod 'RAGVersionNumber'

How to use

Install the pod and import the module RAGVersionNumber.

The core feature of the pod is the convenient representation of version numbers (consisting of major, minor and patch components) by the type VersionNumber. The type has a number of initializers which facilitate creation of version numbers from different sources:

  • init(major:minor:patch:)

    Sets explicit component values. The parameters minor and patch default to 0.

  • init?(string:)

    Parses the given version number string, e.g. "1.2.3" (resulting in version number 1.2.3).

  • init?(bundle:)

    Fetches the string value of CFBundleShortVersionString from the given application bundle.

The type VersionNumber conforms to Comparable. Moreover, there are a couple of convenience methods which check if a given version number is a patch, minor or major successor of the receiver of the call:

  • isPatchSuccessor(of:)
  • isMinorSuccessor(of:)
  • isMajorSuccessor(of:)

See the respective documentation for details.

App Store version number

An additional feature of the pod is the lookup of the version number of an app (identified by its bundle identifier) in the App Store. In order to do so, create an instance of the class AppStoreVersionNumberLookup. The default parameters of its single initializer should be used.

The class has a single public method performLookup(withBundleIdentifier:appStoreCountryCode:completion:) which performs an asynchronous App Store lookup using the iTunes lookup API and passes the result to the given completion. An internet connection is obviously required.

You have to provide the bundle identifier of the app to the first parameter. The App Store country code is optional (its default is "us" i.e. the US App Store). If the app is not available in the App Store in the given country, the method will fail.

The third parameter receives the result of the asynchronous call which is of type AppStoreVersionNumberLookup.Result and contains either the version number or an error. See the documentation for the kinds of error to expect.


raginmari, [email protected]


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

Latest podspec

    "name": "RAGVersionNumber",
    "version": "1.0.3",
    "summary": "Conveniently creates version numbers from different inputs and compares them in helpful ways.",
    "description": "Implements a type that represents a version number with major, minor and patch components. Provides initializers from string and from application bundle. Compares version numbers with respect to their order and equality. Written in Swift 3. Thoroughly tested.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "raginmari": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.3"
    "platforms": {
        "ios": "9.0"
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0.2"
    "source_files": "RAGVersionNumber/Classes/**/*",
    "pushed_with_swift_version": "3.0.2"

Pin It on Pinterest

Share This