Slide 24
Slide 24 text
extension UIView {
/// ࣗͷEdgeʹର੍ͯ͠Λ͚ͭΔ
///
/// - Parameters:
/// - view: ੍ͷج४ͱͳΔview
/// - offset: ੍ (σϑΥϧτ: .zero )
func edges(equalTo view: UIView, offset: UIEdgeInsets = .zero) {
translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
topAnchor.constraint(equalTo: view.topAnchor, constant: offset.top),
bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -offset.bottom),
leftAnchor.constraint(equalTo: view.leftAnchor, constant: offset.left),
rightAnchor.constraint(equalTo: view.rightAnchor, constant: -offset.right)
])
}
}