From 8250172747ff4720d75c73230b2d01c43efae84a Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Tue, 11 Aug 2020 13:47:43 +0200 Subject: [PATCH 1/2] Fix 11.6 build regression --- Sources/Gala/Gala.swift | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Sources/Gala/Gala.swift b/Sources/Gala/Gala.swift index ca82026..ac72d6b 100644 --- a/Sources/Gala/Gala.swift +++ b/Sources/Gala/Gala.swift @@ -25,17 +25,19 @@ public func Layouts(_ layouts: [Layout], _ name: String? = nil, @ViewBu @available(tvOS, unavailable) @available(watchOS, unavailable) public func HorizontalSizeClasses(_ name: String? = nil, @ViewBuilder items: @escaping () -> A) -> some View { - ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in - #if swift(<5.3) + #if swift(<5.3) + return ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in items() .previewDisplayName(name.map { "\($0) \(item!)" } ?? "\(item!)") .environment(\.horizontalSizeClass, item) - #else + } + #else + ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in items() .previewDisplayName(name.map { "\($0) \(item)" } ?? "\(item)") .environment(\.horizontalSizeClass, item) - #endif } + #endif } @@ -43,17 +45,19 @@ public func HorizontalSizeClasses(_ name: String? = nil, @ViewBuilder i @available(tvOS, unavailable) @available(watchOS, unavailable) public func VerticalSizeClasses(_ name: String? = nil, @ViewBuilder items: @escaping () -> A) -> some View { - ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in - #if swift(<5.3) + #if swift(<5.3) + return ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in items() .previewDisplayName(name.map { "\($0) \(item!)" } ?? "\(item!)") .environment(\.verticalSizeClass, item) - #else + } + #else + ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in items() .previewDisplayName(name.map { "\($0) \(item)" } ?? "\(item)") .environment(\.verticalSizeClass, item) - #endif } + #endif } @@ -67,17 +71,19 @@ public func LayoutDirections(_ name: String? = nil, @ViewBuilder items: public func LegibilityWeights(_ name: String? = nil, @ViewBuilder items: @escaping () -> A) -> some View { - ForEach([LegibilityWeight.regular, .bold], id: \.self) { item in - #if swift(<5.3) + #if swift(<5.3) + return ForEach([LegibilityWeight.regular, .bold], id: \.self) { item in items() .previewDisplayName(name.map { "\($0) \(item!)" } ?? "\(item!)") .environment(\.legibilityWeight, item) - #else + } + #else + ForEach([LegibilityWeight.regular, .bold], id: \.self) { item in items() .previewDisplayName(name.map { "\($0) \(item)" } ?? "\(item)") .environment(\.legibilityWeight, item) - #endif } + #endif } public func ContentSizeCategories(_ name: String? = nil, @ViewBuilder items: @escaping () -> A) -> some View { From b30d98bfedf49c1d0370a2b0a44212b299078527 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Tue, 11 Aug 2020 13:49:45 +0200 Subject: [PATCH 2/2] Fix 5.3 build --- Sources/Gala/Gala.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Gala/Gala.swift b/Sources/Gala/Gala.swift index ac72d6b..a670cab 100644 --- a/Sources/Gala/Gala.swift +++ b/Sources/Gala/Gala.swift @@ -32,7 +32,7 @@ public func HorizontalSizeClasses(_ name: String? = nil, @ViewBuilder i .environment(\.horizontalSizeClass, item) } #else - ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in + return ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in items() .previewDisplayName(name.map { "\($0) \(item)" } ?? "\(item)") .environment(\.horizontalSizeClass, item) @@ -52,7 +52,7 @@ public func VerticalSizeClasses(_ name: String? = nil, @ViewBuilder ite .environment(\.verticalSizeClass, item) } #else - ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in + return ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in items() .previewDisplayName(name.map { "\($0) \(item)" } ?? "\(item)") .environment(\.verticalSizeClass, item) @@ -78,7 +78,7 @@ public func LegibilityWeights(_ name: String? = nil, @ViewBuilder items .environment(\.legibilityWeight, item) } #else - ForEach([LegibilityWeight.regular, .bold], id: \.self) { item in + return ForEach([LegibilityWeight.regular, .bold], id: \.self) { item in items() .previewDisplayName(name.map { "\($0) \(item)" } ?? "\(item)") .environment(\.legibilityWeight, item)