“oldValue” and “newValue” default parameters names inside willSet / didSet unrecognized

后端 未结 6 1456
梦谈多话
梦谈多话 2021-02-06 21:44

I am currently writing Swift 3 code in Xcode 8.

When using oldValue and newValue default parameters inside the willSet and

6条回答
  •  广开言路
    2021-02-06 22:27

    The special variable newValue only works within willSet, while oldValue only works within didSet.

    The property as referenced by its name (in this example vc) is still bound to the old value within willSet and is bound to the new value within didSet.

提交回复
热议问题