1

When I run the swift convertor to convert to v3 this got added to one of my VCs'

    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
      }
    }
class MyViewcontroller:UIViewController

So why did this function get added?

user2636197
  • 3,982
  • 9
  • 48
  • 69
  • Access modifier in Swift 3 http://useyourloaf.com/blog/swift-3-access-controls/?utm_campaign=This%2BWeek%2Bin%2BSwift&utm_medium=email&utm_source=This_Week_in_Swift_104 – Muhammad Adnan Oct 03 '16 at 12:16
  • @MuhammadAdnan Sorry I edited my question, what I wonder is why the migrator added this? – user2636197 Oct 03 '16 at 12:33
  • The linked-to Q&A http://stackoverflow.com/questions/39251005/strange-generic-function-appear-in-view-controller-after-converting-to-swift-3 should answer that question. – Martin R Oct 03 '16 at 12:41

1 Answers1

0

If you ask about "fileprivate" keywork, already answered here.

fileprivate allows class fields to be accessed from current file, while private doesn't, even in case of an extension.

Community
  • 1
  • 1
  • Sorry I edited my question, what I wonder is why the migrator added this? – user2636197 Oct 03 '16 at 12:32
  • So that your code is still valid. You have optionals comparison which are no longer supported https://github.com/apple/swift-evolution/blob/master/proposals/0121-remove-optional-comparison-operators.md – CoderPug Oct 12 '16 at 22:45