These are the @IBOutlets I need out in an array
@IBOutlet weak var progressBar1: UIProgressView!
@IBOutlet weak var progressBar2: UIProgressView!
@IBOutlet weak var progressBar3: UIProgressView!
@IBOutlet weak var progressBar4: UIProgressView!
CodePudding user response:
Open the Assistant Editor, right-click and drag from one of your UIProgressView's or just drag from its "Referencing Outlet Collections" to the code file. Insert outlet collection
Then you can drag from your swift file's @IBOutlet to the rest of your UIProgressView's. Add view to collection
CodePudding user response:
let outletList: [UIProgressView] = [progressBar1, progressBar2, progressBar3, progressBar4]
If you have other types of views you can use
let outletList: [UIView] = [...]
Makes sense? or do I miss your goal?
CodePudding user response:
On top declare a variable first like this
var outletLists: [UIProgressView] = []
and now on ViewDidLoad method you can use this to put all outlets on that array
like this:
outlets = [progressBar1, progressBar2, progressBar3, progressBar4]
Hope you understand.
