In an existing Swift for macOS project, I have added a xib file to play around with window and view layouts. I have create a window with a view, and added a button. Now I want to connect the anchors. But the constraints are disabled.
What is required in a view/window to enable the usage of constraints?

The ones that are disabled in your screenshot require two controls to be selected since they are constraints that deal with the alignment between two controls.
If you want to create anchors between the button and the parent view, simply ctrl-drag from inside the button to the parent view and choose the constraint you would like from the popup:
Or, alternatively, use the
Add New Constraintsbutton instead of theAlignbutton: