Just an idea.
I use didSet a lot, and it'd be nice to have a generic way to access the
newValue.
For UI modes:
var anonymousUserMode = false { didSet {
if oldValue == anonymousUserMode { return }
renderLoginOverlay(show: anonymousUserMode)
}}
For animated display strings:
var errorMessage: String? = nil { didSet {
if oldValue == errorMessage { return }
errorLabel.text = errorMessage
// Do some sliding or hiding based on the new value
}}
Has the idea of using $0 / $1 or oldValue / newValue been considered?
I'd like to be able to write this as:
var anonymousUserMode = false { didSet {
if oldValue == newValue { return }
renderLoginOverlay(show: newValue)
}}
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution