[ASDisplayNode] Pass drawParameter in rendering context callbacks #248
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The reasoning for this change is that developers came up with all kinds of interesting ideas how to use properties in the
ASDisplayNodeContextModifier
blocks as it's running on non main properties likebackgroundColor
is not accessible. It is possible to access this properties on the main thread though and as we knowdrawParametersForAsyncLayer
is called on main, developers can store this kind of properties within the draw parameters and use this in theASDisplayNodeContextModifier
blocks. To be able to do that we actually have to pass them in what this PR is planning to do.This is basically an API breakage change and I'm happy to change if we would like to deprecate the old API and move over to this one, but as
willDisplayNodeContentWithRenderingContext
anddidDisplayNodeContentWithRenderingContext
is in the beta header I don't think we have to worry too much, furthermore it's not too hard to change to the newASDisplayNodeContextModifier
block as it's just adding a parameter.