[Solved] Programatically add “Spacing to nearest neighbour” constraint


I can’t constrain it to the specific button though because I don’t have IBOutlets and would rather not add them

Then you are totally stuck. Your requirements are self contradictory. Without a reference to the button of some kind, you cannot possibly make a constraint to it programmatically. There is no “whoever my nearest neighbor is” reference.

1

solved Programatically add “Spacing to nearest neighbour” constraint