Skip to content

Commit

Permalink
Update assertion messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-cfuller committed Mar 2, 2024
1 parent fbd8595 commit d6a478d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Sources/Layout/LayoutItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extension LayoutItem {
}

private var superview: UIView? {
assert(layoutItemView.superview != nil, "`layoutItemView` must have a `superview`")
assert(layoutItemView.superview != nil, "`layoutItemView` requires a `superview`")
return layoutItemView.superview
}

Expand Down
20 changes: 10 additions & 10 deletions Sources/Layout/UIKit/UIView+AutoLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ extension UIView {
public func centerConstraints(
offset: UIOffset = .zero
) -> [NSLayoutConstraint] {
assert(superview != nil, "centerConstraints(offset:) requires superview")
assert(superview != nil, "`centerConstraints(offset:)` requires a `superview`")
guard let superview: UIView
else { return [] }
return [
Expand Down Expand Up @@ -230,7 +230,7 @@ extension UIView {
multiplier: CGFloat = 1,
constant: CGFloat = 0
) -> NSLayoutConstraint {
assert(superview != nil, "constraint(for:is:toSuperview:multiplier:constant:) requires superview")
assert(superview != nil, "`constraint(for:is:toSuperview:multiplier:constant:)` requires a `superview`")
return NSLayoutConstraint(item: self,
attribute: attribute ?? superviewAttribute,
relatedBy: relation,
Expand Down Expand Up @@ -332,7 +332,7 @@ extension UIView {
public func edgeConstraints(
insets: DirectionalInsets
) -> [NSLayoutConstraint] {
assert(superview != nil, "edgeConstraints(insets:) requires superview")
assert(superview != nil, "`edgeConstraints(insets:)` requires a `superview`")
guard let superview: UIView
else { return [] }
return [
Expand All @@ -352,7 +352,7 @@ extension UIView {
public func edgeConstraints(
insets: CanonicalInsets
) -> [NSLayoutConstraint] {
assert(superview != nil, "edgeConstraints(insets:) requires superview")
assert(superview != nil, "`edgeConstraints(insets:)` requires a `superview`")
guard let superview: UIView
else { return [] }
return [
Expand All @@ -372,7 +372,7 @@ extension UIView {
public func sideEdgeConstraints(
inset: CGFloat = 0
) -> [NSLayoutConstraint] {
assert(superview != nil, "sideEdgeConstraints(inset:) requires superview")
assert(superview != nil, "`sideEdgeConstraints(inset:)` requires a `superview`")
guard let superview: UIView
else { return [] }
return [
Expand Down Expand Up @@ -403,7 +403,7 @@ extension UIView {
public func marginConstraints(
insets: DirectionalInsets
) -> [NSLayoutConstraint] {
assert(superview != nil, "marginConstraints(insets:) requires superview")
assert(superview != nil, "`marginConstraints(insets:)` requires a `superview`")
guard let superview: UIView
else { return [] }
return [
Expand All @@ -423,7 +423,7 @@ extension UIView {
public func marginConstraints(
insets: CanonicalInsets
) -> [NSLayoutConstraint] {
assert(superview != nil, "marginConstraints(insets:) requires superview")
assert(superview != nil, "`marginConstraints(insets:)` requires a `superview`")
guard let superview: UIView
else { return [] }
return [
Expand All @@ -443,7 +443,7 @@ extension UIView {
public func sideMarginConstraints(
inset: CGFloat = 0
) -> [NSLayoutConstraint] {
assert(superview != nil, "sideMarginConstraints(inset:) requires superview")
assert(superview != nil, "`sideMarginConstraints(inset:)` requires a `superview`")
guard let superview: UIView
else { return [] }
return [
Expand Down Expand Up @@ -474,7 +474,7 @@ extension UIView {
public func safeAreaConstraints(
insets: DirectionalInsets
) -> [NSLayoutConstraint] {
assert(superview != nil, "safeAreaConstraints(insets:) requires superview")
assert(superview != nil, "`safeAreaConstraints(insets:)` requires a `superview`")
guard let superview: UIView
else { return [] }
return [
Expand All @@ -494,7 +494,7 @@ extension UIView {
public func safeAreaConstraints(
insets: CanonicalInsets
) -> [NSLayoutConstraint] {
assert(superview != nil, "safeAreaConstraints(insets:) requires superview")
assert(superview != nil, "`safeAreaConstraints(insets:)` requires a `superview`")
guard let superview: UIView
else { return [] }
return [
Expand Down

0 comments on commit d6a478d

Please sign in to comment.