Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static func isOutdated(thisVersion: String, comparisonVersion: String) -> Bool {
- let thisVersionComponents = thisVersion.components(separatedBy: ".")
- let comparisonVersionComponents = comparisonVersion.components(separatedBy: ".")
- let thisVersionNumbers: [Int] = thisVersionComponents.map { Int($0) ?? 0 }
- let comparisonVersionNumbers: [Int] = comparisonVersionComponents.map { Int($0) ?? 0 }
- for i in 0 ..< 3 {
- if thisVersionNumbers[i] > comparisonVersionNumbers[i] {
- return false
- }
- else if thisVersionNumbers[i] < comparisonVersionNumbers[i] {
- print("Outdated version")
- return true
- }
- }
- return false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement