From 6336fb8a47734f12f8e374c87ecd1c5649a1272f Mon Sep 17 00:00:00 2001 From: Dan Federman Date: Sat, 20 Apr 2024 22:20:13 -0700 Subject: [PATCH] Add 'return' statements --- Paralayout/ViewDistributionBuilder.swift | 36 ++++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Paralayout/ViewDistributionBuilder.swift b/Paralayout/ViewDistributionBuilder.swift index cb2a28e..dc4b539 100644 --- a/Paralayout/ViewDistributionBuilder.swift +++ b/Paralayout/ViewDistributionBuilder.swift @@ -23,70 +23,70 @@ public struct ViewDistributionBuilder { // Build expressions, which are turned into partial results. public static func buildExpression(_ component: ViewDistributionSpecifying) -> [ViewDistributionSpecifying] { - [component] + return [component] } public static func buildExpression(_ component: CGFloat) -> [ViewDistributionSpecifying] { - [ViewDistributionItem.fixed(component)] + return [ViewDistributionItem.fixed(component)] } public static func buildExpression(_ component: Double) -> [ViewDistributionSpecifying] { - [ViewDistributionItem.fixed(component)] + return [ViewDistributionItem.fixed(component)] } public static func buildExpression(_ component: Int) -> [ViewDistributionSpecifying] { - [ViewDistributionItem.fixed(CGFloat(component))] + return [ViewDistributionItem.fixed(CGFloat(component))] } public static func buildExpression(_ component: [ViewDistributionSpecifying?]) -> [ViewDistributionSpecifying] { - component.compactMap { $0 } + return component.compactMap { $0 } } public static func buildExpression(_ component: [ViewDistributionSpecifying]) -> [ViewDistributionSpecifying] { - component + return component } public static func buildExpression(_ component: ViewDistributionSpecifying?) -> [ViewDistributionSpecifying] { - [component].compactMap { $0 } + return [component].compactMap { $0 } } // Build partial results, which accumulate. public static func buildPartialBlock(first: ViewDistributionSpecifying) -> [ViewDistributionSpecifying] { - [first] + return [first] } public static func buildPartialBlock(first: [ViewDistributionSpecifying]) -> [ViewDistributionSpecifying] { - first + return first } public static func buildPartialBlock(accumulated: ViewDistributionSpecifying, next: ViewDistributionSpecifying) -> [ViewDistributionSpecifying] { - [accumulated, next] + return [accumulated, next] } public static func buildPartialBlock(accumulated: ViewDistributionSpecifying, next: [ViewDistributionSpecifying]) -> [ViewDistributionSpecifying] { - [accumulated] + next + return [accumulated] + next } public static func buildPartialBlock(accumulated: [ViewDistributionSpecifying], next: ViewDistributionSpecifying) -> [ViewDistributionSpecifying] { - accumulated + [next] + return accumulated + [next] } public static func buildPartialBlock(accumulated: [ViewDistributionSpecifying], next: [ViewDistributionSpecifying]) -> [ViewDistributionSpecifying] { - accumulated + next + return accumulated + next } // Build if statements public static func buildOptional(_ component: [ViewDistributionSpecifying]?) -> [ViewDistributionSpecifying] { - component ?? [] + return component ?? [] } public static func buildOptional(_ component: [ViewDistributionSpecifying]) -> [ViewDistributionSpecifying] { - component + return component } // Build if-else and switch statements public static func buildEither(first component: [ViewDistributionSpecifying]) -> [ViewDistributionSpecifying] { - component + return component } public static func buildEither(second component: [ViewDistributionSpecifying]) -> [ViewDistributionSpecifying] { - component + return component } // Build the blocks that turn into results. public static func buildBlock(_ components: [ViewDistributionSpecifying]...) -> [ViewDistributionSpecifying] { - components.flatMap { $0 } + return components.flatMap { $0 } } } #endif