Skip to content

Instantly share code, notes, and snippets.

@RomanEsin
Created January 1, 2021 06:55
Show Gist options
  • Save RomanEsin/f8b34aae65a600261b7e6340534d7a8f to your computer and use it in GitHub Desktop.
Save RomanEsin/f8b34aae65a600261b7e6340534d7a8f to your computer and use it in GitHub Desktop.
A simple extension to quickly preview dark theme of your view in SwiftUI previews.
// In your preview struct just add
// `darkThemePreview()` to the view you're previewing!
import SwiftUI
extension View {
func darkThemePreview() -> some View {
Group {
self
self
.preferredColorScheme(.dark)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment