let's say we have a dynamic button that will have text and clicklistener assigned based off of our server response.
I was wondering the cleanest approach and best practice for assigning this button.
Based off of the server response, my first approach is to assign an enum to our dataclass that will be used by our view layer. This enum tells us what type of button this should be, and based off of this type, we will have a specific text and button click listener for each.
Is this approach so far good or is there a better way to start?
And what is the best way to assign the button data? Should I have maybe a Pair (or other data class?) that will store the text and click listener and have when statement that will make the assignment based off the enum?
What to you guys think is the best approach and will produce the cleanest code?
This would be in Kotlin.