If I understand your question correctly, yes Swift has willSet and didSet property observation built in:
struct SomeStruct {
var someProperty: Int {
willSet {
print("Hello, ")
}
didSet {
print("World!")
}
}
}
class SomeClass {
var someProperty: Int {
willSet {
print("Hello, ")
}
didSet {
print("World!")
}
}
}
solved willSet didSet syntax? Like is it a real thing? [closed]