I am currently writing Swift 3 code in Xcode 8.
When using oldValue and newValue default parameters inside the willSet and didSet blocks, I am getting "unresolved identifier" compiler error.
oldValue
newValue
willSet
didSet
"unresolved identifier"
I have a very basic code as below
var vc:UIViewController? { willSet { print("Old value is (oldValue)") } didSet(viewController) { print("New value is (newValue)") } }
Apple Documentation for Swift 3 still seems to support these feature. I hope I am not missing anything here?
You can also use vc:
vc
var vc:UIViewController? { willSet { print("New value is (newValue) and old is (vc)") } didSet { print("Old value is (oldValue) and new is (vc)") } }
1.4m articles
1.4m replys
5 comments
57.0k users