2

I have migrated my code to Swift 3.0. During migration, below code is added to some of the files. It was not there previously with swift 2.2.

Codes added :

fileprivate func < <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
  switch (lhs, rhs) {
  case let (l?, r?):
    return l < r
  case (nil, _?):
    return true
  default:
    return false
  }
}

fileprivate func > <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
  switch (lhs, rhs) {
  case let (l?, r?):
    return l > r
  default:
    return rhs < lhs
  }
}

What is the meaning of this code and why is it added on its own?

Janmenjaya
  • 4,149
  • 1
  • 23
  • 43
PGDev
  • 23,751
  • 6
  • 34
  • 88
  • 1
    Optional comparison is not supported by default in Swift 3.0. If you have done any optional comparison in those files, then Swift 3 migrator adds this function. – Vishal Singh Sep 22 '16 at 09:12

0 Answers0