We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I try to use the ThemeSwitch on my Home-Page. The implementation is like this:
struct ThemeSwitcher: HTML { @Environment(\.themes) var themes var body: some HTML { ForEach(themes) { theme in Button(theme.id) { SwitchTheme(theme.id) } } } }
But using this in my Home-Page doesn't work, the Theme-Array in @Environment(\.theme) is empty.
@Environment(\.theme)
struct Home: StaticLayout { var title = "Home" var body: some HTML { ThemeSwitcher() // No buttons visible because themes is empty } }
But using the ThemeSwitch in the Layout works:
struct MyLayout: Layout { var id: String = "my-layout" @Environment(\.siteConfiguration) private var config var body: some HTML { HTMLDocument { HTMLHead(for: page, with: config) HTMLBody { Group(page.body) ThemeSwitcher() // theme buttons visible } } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I try to use the ThemeSwitch on my Home-Page. The implementation is like this:
But using this in my Home-Page doesn't work, the Theme-Array in
@Environment(\.theme)
is empty.But using the ThemeSwitch in the Layout works:
The text was updated successfully, but these errors were encountered: