{"id":13467378,"url":"https://github.com/mrackwitz/Version","last_synced_at":"2025-03-26T02:31:21.618Z","repository":{"id":20512591,"uuid":"23791276","full_name":"mrackwitz/Version","owner":"mrackwitz","description":"Represent and compare versions via semantic versioning (SemVer) in Swift","archived":false,"fork":false,"pushed_at":"2023-08-15T15:19:17.000Z","size":115,"stargazers_count":183,"open_issues_count":4,"forks_count":36,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-20T06:46:34.952Z","etag":null,"topics":["cocoapods","ios","macos","semantic-versioning","semver","swift","tvos","version","versioning","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrackwitz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2014-09-08T13:16:52.000Z","updated_at":"2024-11-16T20:34:51.000Z","dependencies_parsed_at":"2023-02-14T01:31:53.288Z","dependency_job_id":"e898fbed-7b89-43c5-b982-9a850cdea8eb","html_url":"https://github.com/mrackwitz/Version","commit_stats":{"total_commits":117,"total_committers":14,"mean_commits":8.357142857142858,"dds":0.4444444444444444,"last_synced_commit":"c8e3521a9cc592bd8879bcf6f96ebab12f952900"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrackwitz%2FVersion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrackwitz%2FVersion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrackwitz%2FVersion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrackwitz%2FVersion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrackwitz","download_url":"https://codeload.github.com/mrackwitz/Version/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245224565,"owners_count":20580366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoapods","ios","macos","semantic-versioning","semver","swift","tvos","version","versioning","watchos"],"created_at":"2024-07-31T15:00:55.617Z","updated_at":"2025-03-26T02:31:21.593Z","avatar_url":"https://github.com/mrackwitz.png","language":"Swift","readme":"# Version\n\n[![CI Status](http://img.shields.io/travis/mrackwitz/Version.svg?style=flat)](https://travis-ci.org/mrackwitz/Version)\n\nVersion is a Swift Library, which enables to represent and compare semantic version numbers.\nIt follows [Semantic Versioning 2.0.0](http://semver.org).\n\nThe representation is:\n\n* Comparable\n* Hashable \u0026 Equatable\n* String Literal Convertible\n* Printable\n\n## Usage\n\nVersions could be either instantiated directly:\n\n```swift\nlet version = Version(\n    major: 1,\n    minor: 2,\n    patch: 3,\n    prerelease: \"alpha.1\",\n    build: \"B001\"\n)\n```\n\nOr they can be converted from a string representation:\n\n```swift\nlet version = try Version(\"1.2.3-alpha.1+B001\")\n\nlet version: Version = \"1.2.3-alpha.1+B001\"\n// The line above is equivalent to:\nlet version = try! Version(\"1.2.3-alpha.1+B001\")\n```\n\nVersions can be compared between each other:\n\n```swift\nlet version = Version(from: ProcessInfo.processInfo.operatingSystemVersion)\n\nif version \u003e \"8.0.0\" {\n    // do something in a more amazing way\n} else if version \u003e \"7.0.0\"\n    // do it an old-fashioned, legacy-style\n} else {\n    // do not care …\n}\n```\n\nBesides UIKit's `UIDevice` the more preferable variant to access\nthe operation system version in Foundation as shown below is supported, too.\n\n```swift\nlet version = Version(from: ProcessInfo.processInfo.operatingSystemVersion)\nif version == \"8.0.1\" {\n    NSLog(\"Sorry no cellular data for you, my friend!\")\n}\n```\n\nFinally Versions can be directly read from bundles:\n\n```swift\nif NSBundle(path: \"Alamofire.framework\").version! \u003c \"1.0.0\" {\n    println(\"Howdy Ho! Such an early-adopter using an unstable version!\")\n    println(\"Beware: “Anything may change at any time.”\")\n\n    // … or insert an actual meaningful special handling\n    // for version-specific *implementation details* here.\n}\n```\n\n**ATTENTION**: Take care when you check versions of frameworks.\nSuch checks happen at runtime. They can hurt performance if used at the wrong\nplace. If there are API changes and you want to consume new methods, you have\nto do that at compile time by checking with precompiler macros (`#if`)\nfor definitions, which have been passed to the compiler build setting\n`OTHER_SWIFT_FLAGS`.\n\n## Installation\n\n### Swift Package Manager\n\n```swift\n.package(url: \"https://github.com/mrackwitz/Version.git\", …),\n```\n\n### Cocoapods\n\nVersion is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following lines to your Podfile:\n\n```ruby\nuse_frameworks!\npod 'Version'\n```\n\n### Carthage\n\n```ruby\ngithub \"mrackwitz/Version\"\n```\n\n## Author\n\nMarius Rackwitz, git@mariusrackwitz.de  \nFind me on Twitter as [@mrackwitz](https://twitter.com/mrackwitz).\n\n## License\n\nVersion is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":["Libs","Version Manager [🔝](#readme)"],"sub_categories":["Version Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrackwitz%2FVersion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrackwitz%2FVersion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrackwitz%2FVersion/lists"}