Not sure if this is possible with swift, so here goes.
I have a string array , these are defined by the user, ie, NO a priori knowledge
for toolbar 1, arrayA:[String]=["f1", "f2", "f3".....]
for toolbar 2, arrayB:[String] =["f3", "f10", "f22"...]
I have a database of functions or matrix if you like for the functions.
to create a bunch of UIButtons is no big deal just loop through a class to define UIButtons, now the tricky part, I want to define actions take for each button as the array value.
a[0]-> create button, name it "f1", set a background image "f1.png", set a color, "f1" and call an action named f1