Apr 17, 2024
Second example is problematic in that you shouldn't be storing the functions that produce the views, but the actual views themselves.
Several reasons for this, but they all boil down to the facts that views are structs and diff'able, while closures and their captured state are not.
Doing the above can lead to state loss and subview update issues. Best avoided.