Skip to content

Conversation

@franklinsch
Copy link
Contributor

Bug/issue #, if applicable: rdar://83564599

Summary

Adds the RenderNodeVariantOverridesApplier API, which applies a variants override patch onto an encoded render node:

let transformedData = try RenderNodeVariantOverridesApplier()
    .applyVariantOverrides(in: encodedRenderNode, for: [.interfaceLanguage("objc")])

It makes use of the (new) underlying JSONPatchApplier API, which generically applies JSON patches over encoded JSON.

The addition of this API is in support of future NavigatorIndex changes to support the multi-language render JSON model.

Changes to patch APIs

The JSONPatchOperation and VariantPatchOperation APIs now support the JSON patch remove operation, which was needed to remove the variantOverrides property in render nodes after applying a patch. They have also been converted to enums since these operations carry different associated values (e.g., a remove doesn't have a value).

Dependencies

None.

Testing

There should be no user-facing changes. The RenderNodeVariantOverridesApplier API should work as expected.

Checklist

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

Adds the `RenderNodeVariantOverridesApplier` API, which applies a
variant overrides patch onto an encoded render node.

rdar://83564599
@franklinsch
Copy link
Contributor Author

@swift-ci please test

@ethan-kusters
Copy link
Contributor

@swift-ci please test

@ethan-kusters
Copy link
Contributor

@swift-ci please test

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.

2 participants