Skip to content

feat(graphics): add MeshGradient API and paint serialization - #1286

Merged
Kyle-Ye merged 2 commits into
mainfrom
feature/mesh_gradient
Nov 29, 2026
Merged

Kyle-Ye merged 2 commits into
mainfrom
feature/mesh_gradient

Conversation

@Kyle-Ye

@Kyle-Ye Kyle-Ye commented Nov 29, 2026

Copy link
Copy Markdown
Member

Summary

Close #1222

  • Add MeshGradient as a view and shape style with support for vertex positions, Bézier control points, and both dynamic and resolved colors.
  • Expose GraphicsContext.Shading.meshGradient(_:) and support animation of mesh geometry, vertex colors, and the background color.
  • Encode and decode mesh paints for archives targeting v6 or later. Use the resolved background color for earlier deployment versions.

Dependency

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T15:54:50.226170Z 1408fb9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added area: animation Animation, transitions, transactions, or timing behavior. area: graphics Color, shape, gradient, image, symbols, and graphics primitives. type: feature New API, behavior, platform support, or user-facing capability. labels Nov 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1408fb9f72

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +658 to +659
case let .meshGradient(data):
self = .meshGradient(.zero - data)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Negate mesh animation data without subtracting from empty arrays

When subtracting mesh animation data from .zero, this expression discards all vertex positions and colors instead of negating them. Both payloads use AnimatableArray, whose zero contains no elements and whose subtraction only processes the minimum operand count, so .zero - data leaves those arrays empty while negating only the background. Applying that result to a mesh then leaves its geometry and vertex colors unchanged because their setters ignore the empty payloads. Scale a copy of data by -1 instead so negation preserves and reverses every component.

Useful? React with 👍 / 👎.

@tuist

tuist Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

🛠️ Tuist Run Report 🛠️

Tests 🧪

Scheme Status Ran test modules Commit
OpenSwiftUI ✅ 7 7d98e76cc

Builds 🔨

Scheme Status Duration Commit
OpenSwiftUI ✅ 1m 41s 7d98e76cc

Reported by Tuist, faster builds and reliable tests for Xcode, Gradle, Bazel, and more.

@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.14981% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.62%. Comparing base (0eebb68) to head (1408fb9).

Files with missing lines Patch % Lines
...penSwiftUICore/Graphic/Gradient/MeshGradient.swift 79.50% 50 Missing ⚠️
...rces/OpenSwiftUICore/Graphic/GraphicsContext.swift 0.00% 2 Missing ⚠️
...nSwiftUICore/Shape/ShapeStyle/ShapeStylePack.swift 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1286      +/-   ##
==========================================
+ Coverage   34.45%   34.62%   +0.16%     
==========================================
  Files        1080     1081       +1     
  Lines       87135    87398     +263     
==========================================
+ Hits        30025    30263     +238     
- Misses      57110    57135      +25     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Kyle-Ye
Kyle-Ye merged commit 96bd2aa into main Nov 29, 2026
7 checks passed
@Kyle-Ye
Kyle-Ye deleted the feature/mesh_gradient branch November 29, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: animation Animation, transitions, transactions, or timing behavior. area: graphics Color, shape, gradient, image, symbols, and graphics primitives. type: feature New API, behavior, platform support, or user-facing capability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add MeshGradient support

1 participant