Created
January 1, 2021 06:55
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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