Code AutoLayout 시 .isActive 반복사용하지 않는 법

NSLayoutConstraint.activate([
    
    emailInfoLabel.leadingAnchor.constraint(equalTo: emailTextFieldView.leadingAnchor, constant: 8),
    emailInfoLabel.trailingAnchor.constraint(equalTo: emailTextFieldView.trailingAnchor, constant: 8),
    emailInfoLabel.centerYAnchor.constraint(equalTo: emailTextFieldView.centerYAnchor),
    
    emailTextField.leadingAnchor.constraint(equalTo: emailTextFieldView.leadingAnchor, constant: 8),
    emailTextField.trailingAnchor.constraint(equalTo: emailTextFieldView.trailingAnchor, constant: 8),
    emailTextField.topAnchor.constraint(equalTo: emailTextFieldView.topAnchor, constant: 15),
    emailTextField.bottomAnchor.constraint(equalTo: emailTextFieldView.bottomAnchor, constant: 2)

])

 

코드로 잡은 오토레이아웃 내 정렬 마다 .isActive 하지 않고 NSLayout 을 사용하면 한번에 Active 하여 쉽고 깔끔하게 사용할 수 있다.