♻️ Simplify max length calculation

This commit is contained in:
Chris Araman 2021-06-04 10:01:03 -07:00
parent e7fbcffbab
commit 2e498380ce

View file

@ -16,10 +16,7 @@ struct SearchResultFormatter {
/// - Returns: Multiliune text outoutp.
static func format(results: [SearchResult], includePrice: Bool = false) -> String {
// find longest appName for formatting, default 50
let maxLength =
results.map(\.trackName).max(by: { $1.count > $0.count })?.count
?? 50
let maxLength = results.map(\.trackName.count).max() ?? 50
var output: String = ""
for result in results {