본 포스팅은 자주 잊어버리는 제가 자주 사용할 거 같은 코드 조각을 중구난방 저장하는 곳입니다.
view.layer.cornerRadius = 8
view.layer.masksToBounds = true
#colorLiteral() 
#imageLiteral()
위 줄을 각각 입력하면 선택할 수 있는 윈도우가 나타난다. 여기서 선택하면 된다.

view.addSubview(loginStackView)
loginStackView.translatesAutoresizingMaskIntoConstraints = false
loginStackView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 30).isActive = true     
loginStackView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -30).isActive = true
loginStackView.topAnchor.constraint(equalTo: view.topAnchor, constant: 200).isActive = true
loginStackView.heightAnchor.constraint(equalToConstant: 200).isActive = true
NSLayoutConstraint.activate([
            loginStackView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 30),
            loginStackView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -30),
            loginStackView.topAnchor.constraint(equalTo: view.topAnchor, constant: 200),
            loginStackView.heightAnchor.constraint(equalToConstant: 200)
])
private lazy var loginStackView: UIStackView = {
        let view = UIStackView(arrangedSubviews: [emailTextFieldView, pwTextFieldView, loginButton])
        view.backgroundColor = .none
        view.spacing = 18
        view.axis = .vertical
        view.distribution = .fillEqually
        view.alignment = .fill
        return view
}()
let alert = UIAlertController(title: "비밀번호 바꾸기", message: "비밀번호를 바꾸시겠습니까?", preferredStyle: .alert )
        
let success = UIAlertAction(title: "확인", style: .default){ action in
     print("확인버튼이 눌렸습니다. ")
}
        
let cancel = UIAlertAction(title: "취소", style: .default){ action in
     print("취소 버튼이 눌렸습니다. ")
}
alert.addAction(success)
alert.addAction(cancel)
 UIView.animate(withDuration: 0.3){
            self.loginStackView.layoutIfNeeded()
}
@objc func textFieldEditingChanged(_ textField : UITextField){
        if textField.text?.count == 1 {
            if textField.text?.first == " "{
                textField.text = ""
                return
            }
        }
        guard
            let email = emailTextField.text, !email.isEmpty,
            let password = pwTextField.text, !password.isEmpty
        else{
            loginButton.backgroundColor = .clear
            loginButton.isEnabled = false
            return
        }
        loginButton.backgroundColor = .red
        loginButton.isEnabled = true
}
tf.addTarget(self, action: #selector(textFieldEditingChanged), for: .editingChanged)
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    self.view.endEditing(true)
}