эй, разработчик, я хочу спросить, у меня есть повторное ограничение создания, а затем я пытаюсь создать функцию, которая возвращает NSLayoutConstraint. тогда я запутался, что мне возвращать, поскольку в моей функции есть 3 разных UIView. здесь я покажу вам мой код.
NSLayoutConstraint.activate([
subtitlebl.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 0),
subtitlebl.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 18),
profileImageView.topAnchor.constraint(equalTo: subtitlebl.bottomAnchor, constant: 24),
profileImageView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 18),
profileImageView.widthAnchor.constraint(equalToConstant: 68),
profileImageView.heightAnchor.constraint(equalToConstant: 68),
editButton.topAnchor.constraint(equalTo: subtitlebl.bottomAnchor, constant: 49),
editButton.leadingAnchor.constraint(equalTo: profileImageView.trailingAnchor, constant: 12),
editButton.widthAnchor.constraint(equalToConstant: 104),
editButton.heightAnchor.constraint(equalToConstant: 20),
profileNameStackView.topAnchor.constraint(equalTo: profileImageView.bottomAnchor, constant: 30),
profileNameStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 24),
profileNameStackView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -24),
profileNameStackView.heightAnchor.constraint(equalToConstant: 74),
phoneStackView.topAnchor.constraint(equalTo: profileNameStackView.bottomAnchor, constant: 30),
phoneStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 24),
phoneStackView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -24),
phoneStackView.heightAnchor.constraint(equalToConstant: 74),
createStackViewConstraint(stackView: profileNameStackView, topStackView: profileImageView, label: profileNameLbl, textFIeld: profileNameTextField)
)]
private func createStackViewConstraint(stackView: UIStackView, topStackView: UIView, label: UILabel, textFIeld: UITextField) -> NSLayoutConstraint {
stackView.topAnchor.constraint(equalTo: topStackView.bottomAnchor, constant: 30).isActive = true
stackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 24).isActive = true
stackView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -24).isActive = true
stackView.heightAnchor.constraint(equalToConstant: 74).isActive = true
label.heightAnchor.constraint(equalToConstant: 18).isActive = true
textFIeld.heightAnchor.constraint(equalToConstant: 48).isActive = true
}