Generate lazy icon properties#66
Conversation
|
Wow, so quick 🚀 |
d5581d1 to
a73b845
Compare
|
@Goooler Lazy delegate should be as an additional option for export, not an replacement for current 🙂 |
|
I'm not sure why Jetpack team used backing properties before, if there are no necessary reasons, we can fully migrate to lazy. Otherwise, we have to add an extra toggle for this, maybe with extra exporting steps? |
|
For my project I prefer backing property approach due to it uses less overhead. Someone prefer using lazy block, due to code more compact. (not remember any existing solutions which provides lazy generation out of the box) I think plugin support both options 🙂 |
| val codeBlock = buildCodeBlock { | ||
| add( | ||
| imageVectorBuilderSpecs( | ||
| iconName = when { | ||
| config.iconNestedPack.isEmpty() -> config.iconName | ||
| else -> "${config.iconNestedPack}.${config.iconName}" | ||
| }, | ||
| vector = vector, | ||
| path = { | ||
| vector.nodes.forEach { node -> addVectorNode(node) } | ||
| }, | ||
| ), | ||
| ) | ||
| addStatement("") | ||
| addStatement("return %N!!", backingProperty) | ||
| } | ||
|
|
||
| delegate( | ||
| CodeBlock.builder() | ||
| .beginControlFlow("lazy(%T.NONE)", ClassNames.LazyThreadSafetyMode) | ||
| .add(codeBlock) | ||
| .endControlFlow() | ||
| .build(), | ||
| ) |
There was a problem hiding this comment.
All here, you can copy and paste anytime. I'll leave the PR here until I have more time to take or finish by you.
|
Closed due to #70. |
Uh oh!
There was an error while loading. Please reload this page.