DelawareMathGuy,
I defined the constraint in IB (using the little tie-fighter icon), then highlighted the constraint and dragged it into the code and assigned an IBOutlet name to the constraint.
>>when i set it to active = false, the constraint reference immediately became nil
I believe this is exactly what is happening to me (please read below). This feels wrong to me.
Claude:
If I add the "print" statements like you requested (as below) ...
print("isPortrait imageViewTopConstraint", imageViewTopConstraint)
then I see the following warnings produced for that "print" line
Coercion of implicitly unwrappable value of type 'NSLayoutConstraint?' to 'Any' does not unwrap optional
Provide a default value to avoid this warning
Force-unwrap the value to avoid this warning
Explicitly cast to 'Any' with 'as Any' to silence this warning
That being said, since these are just warnings, I ran the code anyway.
Results
ViewWillLayoutSubviews
isPortrait seatPos1TopAlignment_Constraint = Optional(<NSLayoutConstraint:0x600000a53c00 UIView:0x7f9d937659f0.top == UILayoutGuide:0x60000107cb60'UIViewSafeAreaLayoutGuide'.top + 313.033 (active)>)
ViewWillLayoutSubviews
isPortrait seatPos1TopAlignment_Constraint = Optional(<NSLayoutConstraint:0x600000a53c00 UIView:0x7f9d937659f0.top == UILayoutGuide:0x60000107cb60'UIViewSafeAreaLayoutGuide'.top + 313.033 (active)>)
ViewWillLayoutSubviews
isPortrait seatPos1TopAlignment_Constraint = Optional(<NSLayoutConstraint:0x600000a53c00 UIView:0x7f9d937659f0.top == UILayoutGuide:0x60000107cb60'UIViewSafeAreaLayoutGuide'.top + 313.033 (active)>)
ViewWillLayoutSubviews
isPortrait seatPos1TopAlignment_Constraint = Optional(<NSLayoutConstraint:0x600000a53c00 UIView:0x7f9d937659f0.top == UILayoutGuide:0x60000107cb60'UIViewSafeAreaLayoutGuide'.top + 313.033 (active)>)
ViewWillLayoutSubviews
isPortrait seatPos1TopAlignment_Constraint = Optional(<NSLayoutConstraint:0x600000a53c00 UIView:0x7f9d937659f0.top == UILayoutGuide:0x60000107cb60'UIViewSafeAreaLayoutGuide'.top + 313.033 (active)>)
ViewWillLayoutSubviews
isLandscape seatPos1TopAlignment_Constraint before = Optional(<NSLayoutConstraint:0x600000a53c00 UIView:0x7f9d937659f0.top == UILayoutGuide:0x60000107cb60'UIViewSafeAreaLayoutGuide'.top + 313.033 (active)>)
isLandscape seatPos1TopAlignment_Constraint after = nil
ViewWillLayoutSubviews
isLandscape seatPos1TopAlignment_Constraint before = nil
Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file /Users/unclet/Dads Stuff/Swift Projects/Backup/OhHell 3/OhHell/GameplayViewController.swift, line 3313
QUESTION
You were correct, the constraint moved to a NIL state, however, I am still not sure how it gets set to NIL. Does setting the constraint "isActive = false" make the constraint NIL? This does not seem correct.