https://github.com/haidalinda/AppVersion
AppVersion is a Swift μ-Library offering a structured type around iOS app versions that adhere to Semantic Versioning :1234:
https://github.com/haidalinda/AppVersion
appversion ios semver swift
Last synced: 14 days ago
JSON representation
AppVersion is a Swift μ-Library offering a structured type around iOS app versions that adhere to Semantic Versioning :1234:
- Host: GitHub
- URL: https://github.com/haidalinda/AppVersion
- Owner: hkellaway
- License: mit
- Created: 2020-09-09T00:59:41.000Z (almost 6 years ago)
- Default Branch: trunk
- Last Pushed: 2020-09-28T00:16:40.000Z (over 5 years ago)
- Last Synced: 2025-01-03T03:45:30.760Z (over 1 year ago)
- Topics: appversion, ios, semver, swift
- Language: Swift
- Homepage:
- Size: 93.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# AppVersion

[](https://github.com/apple/swift-package-manager)
[](https://github.com/CocoaPods/CocoaPods)
[](https://github.com/hkellaway/AppVersion/blob/trunk/LICENSE)
[](https://travis-ci.org/hkellaway/AppVersion)
A Swift μ-Library for determining app version
## Basic Usage
AppVersion is a simple little library that offers a structured type around typical app versioning. It currently supports the format of `major.minor.patch`, a subspecies of [Semver](https://semver.org/).
### Retrieving from Bundle
``` swift
let currentAppVersion: AppVersion? = .fromBundle
```
### Creation from String
An `AppVersion` can conveniently be created from a `String`:
``` swift
let appVersion: AppVersion = "1.2.3"
```
### Comparison
Comparison operations (`==`, `>`, `<`, etc.) work seamlessly:
``` swift
let minimumAppVersion: AppVersion = "2.0.0"
guard let currentAppVersion: AppVersion = .fromBundle, currentAppVersion >= minimumAppVersion else {
// send user to App Store
}
```
## SemVer Utility
### Determining Stability
To determine whether the version is stable / has a public API:
``` swift
appVersion.isStable
```
### Next Version
To detemrine the next version:
``` swift
appVersion.nextMajor() // i.e. 1.2.3 goes to 2.0.0
appVersion.nextMinor() // i.e. 1.2.3 goes to 1.3.0
appVersion.nextPatch() // i.e. 1.2.3 goes to 1.2.4
```
## Installation
### Swift Package Manager
See [Adding Package Dependencies to Your App](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app). Point to the desired version or the `trunk` branch.
### CocoaPods
```ruby
pod 'AppVersion', :git => 'https://github.com/hkellaway/AppVersion.git', :branch => 'trunk'
```
## Credits
AppVersion was created by [Harlan Kellaway](http://hkellaway.github.io).
## License
AppVersion is available under the MIT license. See the [LICENSE](https://github.com/hkellaway/AppVersion/blob/trunk/LICENSE) file for more info.