I have this code on an UIView
subclass:
override var hidden: Bool {
willSet {
DDLogDebug("Will set hidden=\(String(newValue)) on \(item?.name))")
}
didSet {
DDLogDebug("Did set hidden=\(String(hidden)) on \(item?.name))")
}
}
For some reason, I set false
but it remains true
as seen in these logs:
> Will set hidden=false on Optional("74D8E4CE-5E14-4914-8483-E9F66D2A79B7"))
> Did set hidden=true on Optional("74D8E4CE-5E14-4914-8483-E9F66D2A79B7"))
The only peculiarity of this issue is that it only happens when running inside a UIView.animateWithDuration(...)
block. If I remove the animation the property is set correctly.
Any thoughts on what may be going on? This is driving me crazy, heh
Edit:
Little bit more info, this UIView I want to hide is an arrangedSubview
of a UIStackView
. It works correctly for the first few tries but suddenly stops working without any noticeable pattern.