I wanted to use a nested for loop to display the names of array names on each of the buttons in the for loop. I want to do everything in one loop. Right now my code works but the only name being printed is clear and its on every button. The buttons should go one pen etc. You can assume all of the items are buttons.
let names = ["line", "pen", "graph","save","nxt","opacityBtn","strokeSize","undo","clear"]
var increase = 0.1
for b in [line, pen, graph,save,nxt,opacityBtn,strokeSize,undo,clear] {
b.backgroundColor = UIColor.init(red: CGFloat(increase), green: 0.2, blue: 0.2, alpha: 1)
increase += 0.10
b.layer.borderWidth = 1
for i in names{
b.setTitle(i, for: .normal)
}
}