Closed markst closed 1 year ago
If I wrap my previews in the following:
public struct UIElementPreview<Value: View>: View { private let dynamicTypeSizes: [ContentSizeCategory] = [.extraSmall, .large, .extraExtraExtraLarge] /// Filter out "base" to prevent a duplicate preview. private let localizations = Bundle.main.localizations.map(Locale.init).filter { $0.identifier != "base" } private let viewToPreview: Value public init(_ viewToPreview: Value) { self.viewToPreview = viewToPreview } public var body: some View { Group { ForEach(localizations, id: \.identifier) { locale in self.viewToPreview .previewLayout(PreviewLayout.sizeThatFits) .padding() .environment(\.locale, locale) .previewDisplayName(Locale.current.localizedString(forIdentifier: locale.identifier)) } self.viewToPreview .previewLayout(PreviewLayout.sizeThatFits) .padding() .background(Color(.systemBackground)) .environment(\.colorScheme, .dark) .previewDisplayName("Dark Mode") ForEach(dynamicTypeSizes, id: \.self) { sizeCategory in self.viewToPreview .previewLayout(PreviewLayout.sizeThatFits) .padding() .environment(\.sizeCategory, sizeCategory) .previewDisplayName("\(sizeCategory)") } } } }
My generated snapshots have more context rather than just incremental numbers.
test_prefireView_Preview.PrefireView.png
Closes #16
If I wrap my previews in the following:
My generated snapshots have more context rather than just incremental numbers.
test_prefireView_Preview.PrefireView.png
Closes #16