Skip to content

Commit

Permalink
Merge pull request #8 from finestructure/xcode12-b4
Browse files Browse the repository at this point in the history
Fix Xcode12b4 compile errors
  • Loading branch information
finestructure authored Aug 10, 2020
2 parents 3d2c388 + 81722d5 commit 721c403
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Sources/Gala/Gala.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ public func Layouts<A: View>(_ layouts: [Layout], _ name: String? = nil, @ViewBu
@available(watchOS, unavailable)
public func HorizontalSizeClasses<A: View>(_ name: String? = nil, @ViewBuilder items: @escaping () -> A) -> some View {
ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in
#if swift(<5.3)
items()
.previewDisplayName(name.map { "\($0) \(item!)" } ?? "\(item!)")
.environment(\.horizontalSizeClass, item)
#else
items()
.previewDisplayName(name.map { "\($0) \(item)" } ?? "\(item)")
.environment(\.horizontalSizeClass, item)
#endif
}
}

Expand All @@ -38,9 +44,15 @@ public func HorizontalSizeClasses<A: View>(_ name: String? = nil, @ViewBuilder i
@available(watchOS, unavailable)
public func VerticalSizeClasses<A: View>(_ name: String? = nil, @ViewBuilder items: @escaping () -> A) -> some View {
ForEach([UserInterfaceSizeClass.compact, .regular], id: \.self) { item in
#if swift(<5.3)
items()
.previewDisplayName(name.map { "\($0) \(item!)" } ?? "\(item!)")
.environment(\.verticalSizeClass, item)
#else
items()
.previewDisplayName(name.map { "\($0) \(item)" } ?? "\(item)")
.environment(\.verticalSizeClass, item)
#endif
}
}

Expand All @@ -56,9 +68,15 @@ public func LayoutDirections<A: View>(_ name: String? = nil, @ViewBuilder items:

public func LegibilityWeights<A: View>(_ name: String? = nil, @ViewBuilder items: @escaping () -> A) -> some View {
ForEach([LegibilityWeight.regular, .bold], id: \.self) { item in
#if swift(<5.3)
items()
.previewDisplayName(name.map { "\($0) \(item!)" } ?? "\(item!)")
.environment(\.legibilityWeight, item)
#else
items()
.previewDisplayName(name.map { "\($0) \(item)" } ?? "\(item)")
.environment(\.legibilityWeight, item)
#endif
}
}

Expand Down

0 comments on commit 721c403

Please sign in to comment.