Auto Layout에 필요한 필수 constraint 4가지
redView.heightAnchor.constraint(equalToConstant: 50).isActive = true
redView.widthAnchor.constraint(equalToConstant: 100).isActive = true
// width
redView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20).isActive = true
redView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20).isActive = true
// height
redView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 100).isActive = true
redView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -100).isActive = true
Labels, buttons, text fields처럼 intrinsin content size가 존재하는 경우 x position과 y position만 지정해줘도 괜찮다.