Skip to content

Feat: Add composable Scene modifiers and Scene environment propagation#70

Merged
phranck merged 3 commits into
mainfrom
issue/19-scene-composition
Jul 22, 2026
Merged

Feat: Add composable Scene modifiers and Scene environment propagation#70
phranck merged 3 commits into
mainfrom
issue/19-scene-composition

Conversation

@phranck

@phranck phranck commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Closes #19. Fixes #2.

Summary

  • Scene gets SwiftUI's protocol shape (associatedtype Body: Scene, @SceneBuilder var body) with Never as the primitive terminator; WindowGroup declares a primitive body and SceneBuilder gains buildExpression
  • New composable scene-modifier layer: Scene.environment(_:_:), .palette(_:), .appearance(_:) wrap scenes in an internal EnvironmentModifiedScene; SceneResolution unwinds chains outside-in into the frame environment (inner values win) and hands the renderable core to the render loop — this layer is the documented extension point for the Enhancement: Implementation of an Application Menu System #5 command infrastructure
  • RenderLoop applies scene values before the view-level root palette override, so scene environment reaches all child views and out-of-tree surfaces (status bar, app header); identity paths stay byte-identical for unwrapped scenes via existential opening
  • ScenePhase (background < inactive < active) with a scenePhase environment key defaulting to .active; phase-driven actions arrive with [P2-28] Add terminal accessibility, search, refresh, and application actions #33, multiwindow semantics deliberately not copied
  • The README/issue-#2 shape WindowGroup { … }.palette(…) now compiles and changes rendered colors; covered by tests and the scene compile fixture (including an App body using scene modifiers)

Test plan

  • 1372 tests green on macOS (Swift 6.0.3) and Linux (Docker 6.0.3-noble), warning-fatal, via ./scripts/test-linux.sh
  • New SceneCompositionTests: resolution, outside-in composition, innermost-wins, rendering through modifiers, ScenePhase defaults/ordering
  • verify-compatibility-manifest.sh passes against the regenerated manifest

phranck added 3 commits July 22, 2026 14:30
- Give Scene the SwiftUI protocol shape (associated Body, SceneBuilder
  body) with Never as the primitive terminator
- Add the EnvironmentModifiedScene layer with Scene.environment(_:_:),
  .palette(_:), and .appearance(_:) modifiers; SceneResolution unwinds
  modifier chains outside-in into the frame environment (inner values
  win) and returns the renderable core
- Resolve scenes in RenderLoop before the view-level root palette
  override so scene values reach all views and out-of-tree surfaces;
  identity paths stay byte-identical for unwrapped scenes
- Add ScenePhase with an environment key (active by default); phase
  actions arrive with the application-actions work
- Fixes the documented WindowGroup { … }.palette(…) shape from issue #2
- Add the scene-level palette section to the theming guide
- Extend the scene fixture with the issue-2 palette shape, composed
  modifiers, and an App body using scene modifiers
- Add overrides for the Scene protocol body contract, the scene
  environment modifiers, WindowGroup's primitive body, ScenePhase, and
  the scenePhase environment key
- Regenerate the manifest with TUIkitAPICheck against fresh 6.0.3
  macOS and Linux snapshots
@phranck
phranck merged commit 618039a into main Jul 22, 2026
6 checks passed
@phranck
phranck deleted the issue/19-scene-composition branch July 22, 2026 12:51
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

Successfully merging this pull request may close these issues.

[P1-14] Add composable Scene modifiers and Scene environment propagation .palette Modifier Cannot be Applied to WindowGroup

1 participant