Hoşgeldin. Soru sormak veya cevaplamak için hemen üye ol.
0 oy
767 kez görüntülendi
ios development kategorisinde tarafından
Class'ın en üstüne bu kodlar eklenmiş:

// 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

  }

}

 

// 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

  default:

    return rhs < lhs

  }

}

Ne anlama geliyor, ne yapmam lazım. Hiçbir şey anlamadım.

1 cevap

0 oy
tarafından

opsiyonel değerler için ilişkisel operatörlerin kullanımı swift 3'de kaldırıldı.
o kodların eklendiği class'lar da muhtemelen daha önce sorduğun array probleminde olduğu gibi, bu defa opsiyonel değerlerin denetlenmesi durumu var.

örnekleri şuradan inceleyebilirsin.

https://github.com/apple/swift-evolution/blob/master/proposals/0121-remove-optional-comparison-operators.md

tarafından
İnceleyeğim ilerde not aldım. Şimdilik Swift 2 ile yola devam :)
...