Any advice on what’s best in terms of app size optimization between a (app)variable object with 3 properties and 3 standalone (app)variables?
Same here. Should I instead make one show object with 2 properties card and login? And any risk of true/false conflict?
my solution is usually either a single object with mutliple properties, if it is some data or a “list of texts” if it is a visibility.
So in your case I would do this:
appVars.visibility - type list of texts.
Set the visibility of the “card” component to formula:
When you trigger the visibility change you can do this formula:
IF(IS_IN_ARRAY(appVars.visibility, "card"), WITHOUT_ITEM(appVars.visibility, "card), WITH_UNIQUE_ITEM(appVars.visibility,"card")
Hope this helps.
Thanks man. Brilliant.
Isn’t adding such formula offsetting my goal of saving bytes and app size. In other words, are these formulas significantly better than a couple of variables at optimizing the app?
In other words, are one variable + formula really better than two true/false variables? Doesn’t that var-formula combo become worthy when replacing at least 3 or 4 variables?
Sorry I’m challenging you here in order to understand how variables affect the performance and size of an app
This is something I never tested. Honestly, none of my apps ever exceeded the 100mb, even if they had some fancy complex components. I might test this later.
But 1 thing is sure, if you have more than 4-5 components that you want to control visibility by variables it’ll be way easier to navigate in Composer with my approach.
One more thing to consider, setting the visibility this way might cause some difficulties with the animate component flow.
Quick question can I use single object with multiple properties for simple true/false values (unrelated to visibility but rather: is_new_user, is_returning,…)?
why not? I mean there is one thing to keep in mind with this. When you want to set a single property of it make sure you not “set the whole variable” Because that would ruin the schema.
What do I mean?
isreturn=true' and set the visible=true`
Then a button is tapped and you set the “page variable” (but only the spwcific property:
.visible to false that may in some cases result in the whole variable forgetting its own properties and only remembering this latest property and value.
Hope this makes sense…
I faced this issue with the dropdown values bound to a pageVar with 2 properties. The var would confuse values.
So you mean that this schema is risky?
UPDATE: Actually it won’t work as I’m using these vars in event flows. They must remain as standalone vars.