Skip to content
New issue

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

Support <meta>/<title> in Fiber renderers #503

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

carson-katri
Copy link
Member

This adds compatibility with the .htmlMeta() and .htmlTitle() modifiers added in #483. 2 special cases were also added:

  1. WindowGroup has a title parameter, which can now be used to specify the <title> tag in Fiber renderers by extending the _WindowGroupTitle view.

  2. In SwiftUI, if a _BackgroundStyleModifier reaches the top of the scene, it will extend into the top safe area. This PR adds the "theme-color" meta tag when the background style reaches the top of the scene:

Simulator Screen Shot - iPhone 13 Pro - 2022-07-06 at 10 49 28 Screen Shot 2022-07-06 at 10 42 51 AM

While Safari will automatically detect the theme color without the additions from this PR, it will not pick up background color changes due to state. The changes from this PR allow that.

@carson-katri carson-katri added SwiftUI compatibility Tokamak API differences with SwiftUI Fiber Changes related to the FiberReconciler or a FiberRenderer labels Jul 6, 2022
@@ -15,6 +15,11 @@
// Created by Carson Katri on 7/16/20.
//

@_spi(TokamakCore)
public struct _WindowGroupTitle: _PrimitiveView {
public let title: Text?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be an optional?

In WindowGroups where title is nil, it should be more efficient to not use a _WindowGroupTitle at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fiber Changes related to the FiberReconciler or a FiberRenderer SwiftUI compatibility Tokamak API differences with SwiftUI
Development

Successfully merging this pull request may close these issues.

2 participants