Skip to content

Commit a57fdb1

Browse files
committed
Add runtime check for pinEdges
1 parent 8a75e49 commit a57fdb1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Modules/Sources/WordPressUI/Extensions/UIView+AutoLayout.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ extension UIView {
2828
}
2929
translatesAutoresizingMaskIntoConstraints = false
3030

31+
#if DEBUG
32+
if let target = target as? UIView {
33+
assert(!target.isDescendant(of: self), "The target view can't be a descendant for the view")
34+
}
35+
#endif
36+
3137
var constraints: [NSLayoutConstraint] = []
3238

3339
func pin(_ edge: Edge.Set, _ closure: @autoclosure () -> NSLayoutConstraint) {

0 commit comments

Comments
 (0)