Setting the priority of the bottom or trailing constraint (based on you want dynamic height or dynamic width) to 999 solved the problem for me.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: