Sort order

This commit is contained in:
relikd
2020-06-08 23:38:09 +02:00
parent e13b3df2c4
commit 946acc2460
7 changed files with 197 additions and 59 deletions

View File

@@ -26,3 +26,16 @@ extension UIEdgeInsets {
self.init(top: top ?? all, left: left ?? all, bottom: bottom ?? all, right: right ?? all)
}
}
infix operator =? : ComparisonPrecedence
extension Equatable {
/// Assign a new value to `lhs` if the `newValue` differs from the previous value. Return whether the new value was set.
/// - Returns: `true` if `lhs` was overwritten with another value
static func =?(lhs: inout Self, newValue: Self) -> Bool {
if lhs != newValue {
lhs = newValue
return true
}
return false
}
}