Version
Version is a Swift Library, which enables to represent and compare semantic version numbers.
It follows Semantic Versioning 2.0.0.
The representation is:
- Comparable
- Hashable & Equatable
- String Literal Convertible
- Printable
Usage
Versions could be either instantiated directly:
Or they can be converted from a string representation:
Versions can be compared between each other:
Besides UIKit's UIDevice
the more preferable variant to access
the operation system version in Foundation as shown below is supported, too.
Finally Versions can be directly read from bundles:
ATTENTION: Take care when you check versions of frameworks.
Such checks happen at runtime. They can hurt performance if used at the wrong
place. If there are API changes and you want to consume new methods, you have
to do that at compile time by checking with precompiler macros (#if
)
for definitions, which have been passed to the compiler build setting
OTHER_SWIFT_FLAGS
.
Installation
Swift Package Manager
Cocoapods
Version is available through CocoaPods. To install
it, simply add the following lines to your Podfile:
Carthage
Author
Marius Rackwitz, git@mariusrackwitz.de
Find me on Twitter as @mrackwitz.
License
Version is available under the MIT license. See the LICENSE file for more info.