Skip to content

Instantly share code, notes, and snippets.

@katleta3000
Created October 21, 2018 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katleta3000/51f8f9704ca2a7211cfe4831208abd14 to your computer and use it in GitHub Desktop.
Save katleta3000/51f8f9704ca2a7211cfe4831208abd14 to your computer and use it in GitHub Desktop.
func compareVersion(version1: String, version2: String) {
let result = version1.compare(version2, options: .numeric)
if result == .orderedDescending {
print("\(version1) > \(version2)")
} else if result == .orderedAscending {
print("\(version1) < \(version2)")
} else {
print("\(version1) == \(version2)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment