From 9d2ea26fe1e17b529055886b4826427df7cdd26d Mon Sep 17 00:00:00 2001 From: Petr Sima Date: Sat, 23 May 2020 09:06:55 +0200 Subject: [PATCH] Fix layout of NightAndDay by replacing ZStack with .background --- Sources/Gala/Gala.swift | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Sources/Gala/Gala.swift b/Sources/Gala/Gala.swift index f5bde80..bdfc966 100644 --- a/Sources/Gala/Gala.swift +++ b/Sources/Gala/Gala.swift @@ -4,14 +4,8 @@ import SwiftUI public func NightAndDay(_ name: String? = nil, @ViewBuilder items: @escaping () -> A) -> some View { ForEach(ColorScheme.allCases, id: \.self) { scheme in // Credit https://twitter.com/heckj/status/1239968146682863618 - ZStack { - if scheme == .dark { - Color.black - } else { - Color.white - } - items() - } + items() + .background(scheme == .dark ? Color.black : .white) .previewDisplayName(name.map { "\($0) \(scheme)" } ?? "\(scheme)") .environment(\.colorScheme, scheme) }