Few days ago, I converted my old Xcode 8 project to Swift 4 in Xcode 9. I noticed additional Swift codes generated along with explanation just above the code.
Here what it looks like:
// FIXME: comparison operators with optionals were removed from the Swift Standard Libary.
// Consider refactoring the code to use the non-optional operators.
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
}
}
I tried to understand what the code does and find what I think is kind of unusual _?
in the code.
I guess it is unused optional because _
means we are not going to use a particular variable so we don't care about a variable's name and ?
is optional syntax.
Thank you for your help!