Skip to content

Document the different graphs & hierarchies in play along with their lifecycles #101

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

Open
vmanot opened this issue Aug 5, 2024 · 2 comments

Comments

@vmanot
Copy link

vmanot commented Aug 5, 2024

SwiftUI is a complex beast. Going through the codebase as well as other articles by people who've tried to understand how it concretely works, I recognize the following distinct graphs and hierarchies conceptually:

  • The attribute graph (OGGraph and OGSubgraph, subgraphs can own subgraphs and attributes)
  • ViewGraph

Some questions that I don't have a good answer to despite going over the codebase a dozen times:

  • How do ViewInputs and ViewOutputs relate to AttributeGraph? I see sifting through a lot of indirection that they're creating Attributes in many places, I'm assuming the initialization/mutation of these attributes are tracked by some AttributeGraph-owned closure that they are being executed within.
  • What is the lifecycle of a ViewGraph?
  • Does ViewGraph maintain its hierarchy solely through PreferenceBridge?
  • DisplayList?
  • What other hierarchies are known to you?
@Kyle-Ye
Copy link
Member

Kyle-Ye commented Sep 17, 2024

Part of the info has already outdated. I'm planning to realign the part to iOS 18 recently.

Keep tuned.

@Kyle-Ye
Copy link
Member

Kyle-Ye commented Oct 7, 2024

DisplayList

SwiftUI will construct DisplayList in UIHostingView/ViewGraph and many other places. And will eventually kick off a render process via RendererHost (Diff & delta time & addSubview/insertLayer).

See more detail on #136.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants