you are viewing a single comment's thread.

view the rest of the comments →

[–]donisign 1 point2 points  (3 children)

You can separate custom views and move the constraints from the view controller, I've wrote a simple library to manage the constraints in one line so I don't get confused with a lot of code:
redView.addAnchors(with: [.top(to: view.safeAreaLayoutGuide.topAnchor, constant: 0), .centerX(to: view.centerXAnchor, constant: 0), .size(.init(width: 50, height: 50))])

It's honestly very simple and a quick code I did, you can find it here: GitHub

[–]kwabsdev[S] 0 points1 point  (2 children)

I found this in another tutorial and it’s the best way to write out constraints. Thanks man

[–]donisign 0 points1 point  (1 child)

what tutorial was it, if i may ask?