Skip to content

Commit

Permalink
Use guard instead of if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-cfuller committed Apr 5, 2024
1 parent 42fd18b commit 0575417
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Tests/LayoutTests/Support/View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ internal final class View: UIView {
} else {
identifier = "View"
}
if #available(iOS 15.0, *) {
let minX: String = frame.minX.formatted()
let minY: String = frame.minY.formatted()
let width: String = frame.width.formatted()
let height: String = frame.height.formatted()
return "<\(identifier); frame = (x: \(minX), y: \(minY), width: \(width), height: \(height))>"
}
fatalError("iOS 15+ required for unit tests.")
guard #available(iOS 15.0, *)
else { fatalError("iOS 15+ required for unit tests.") }
let minX: String = frame.minX.formatted()
let minY: String = frame.minY.formatted()
let width: String = frame.width.formatted()
let height: String = frame.height.formatted()
return "<\(identifier); frame = (x: \(minX), y: \(minY), width: \(width), height: \(height))>"
}

internal convenience init(named name: String, with color: UIColor) {
Expand Down

0 comments on commit 0575417

Please sign in to comment.