I have a constraint in my view controller that gets deactivated by the system for some reason when the app goes into the background and then coming back to foreground. I haven't been able to pinpoint who's deactivating the constraint. I subclassed NSLayoutConstraint
to catch when it's deactivated but the precondition is never triggered. So I'm out of ideas why this is happening and how to prevent it.
@IBOutlet private(set) var testConstraint: TestConstraint!
class TestConstraint: NSLayoutConstraint {
override var isActive: Bool {
didSet {
precondition(isActive, "isActive should not be set to false")
}
}
}