gordontucker / FittedSheets

Bottom sheets for iOS
MIT License
1.35k stars 278 forks source link

.intrinsic size conflicting constraints #219

Open SaladDays831 opened 1 year ago

SaladDays831 commented 1 year ago

I'm getting conflicting constraint errors even with the most basic setup when using .intrinsic size

class DemoViewController: UIViewController {

    private let demoView = UIView()

    override func viewDidLoad() {
        super.viewDidLoad()

        view.addSubview(demoView)
        demoView.translatesAutoresizingMaskIntoConstraints = false
        demoView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
        demoView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16).isActive = true
        demoView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16).isActive = true
        demoView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
        demoView.heightAnchor.constraint(equalToConstant: 200).isActive = true
    }
}
func buttonPressed() {
        let controller = DemoViewController()
        let options = SheetOptions()
        let sheet = SheetViewController(controller: controller, sizes: [.intrinsic], options: options)
        self.present(sheet, animated: true)
    }

This results in these conflicting constraints:

"<NSLayoutConstraint:0x600002135950 UIView:0x106006cd0.bottom == UIView:0x10600aa70.bottom   (active)>",
    "<NSLayoutConstraint:0x600002135c20 UIView:0x106006a30.bottom == UIView:0x106006cd0.bottom   (active)>",
    "<NSLayoutConstraint:0x600002135c70 V:|-(0)-[UIView:0x106006a30]   (active, names: '|':UIView:0x106006cd0 )>",
    "<NSLayoutConstraint:0x600002135e50 V:|-(0)-[UIView:0x106006e60]   (active, names: '|':UIView:0x106006a30 )>",
    "<NSLayoutConstraint:0x600002135f40 UIView:0x106006e60.bottom == UIView:0x106006a30.bottom   (active)>",
    "<NSLayoutConstraint:0x600002136580 UIView:0x106005e60.height == 200   (active)>",
    "<NSLayoutConstraint:0x600002136440 V:|-(0)-[UIView:0x106005e60]   (active, names: '|':UIView:0x10600d2a0 )>",
    "<NSLayoutConstraint:0x600002136530 UIView:0x106005e60.bottom == UIView:0x10600d2a0.bottom   (active)>",
    "<NSLayoutConstraint:0x6000021365d0 UIView:0x10600d2a0.bottom == UIView:0x106006e60.bottom   (active)>",
    "<NSLayoutConstraint:0x600002136a80 V:|-(0)-[UIView:0x10600d2a0]   (active, names: '|':UIView:0x106006e60 )>",
    "<NSLayoutConstraint:0x6000021359a0 V:|-(0)-[UIView:0x106006cd0]   (active, names: '|':UIView:0x10600aa70 )>",
    "<NSLayoutConstraint:0x600002136b20 'UIView-Encapsulated-Layout-Height' UIView:0x10600aa70.height == 852   (active)>"