Reputation: 89
I have a few picker view that I added in a outlet collection, they should have different properties that I need to add them in their didset for example, here is the outlet collection
@IBOutlet var dataPickers: [UIPickerView]! {
didset {
}
}
The problem is, i have to say that if the first member of dataPickers
do that things, but I don't know how I can say that in the didset.
could anyone help me on this? thank you so much
Upvotes: 0
Views: 260
Reputation: 318824
The didSet
is called when the whole array is set. If you want to apply properties to just the first picker in the array, then you can do something like:
@IBOutlet var dataPickers: [UIPickerView]! {
didSet {
if let first = dataPickers.first {
first.someProperty = someValue
}
}
}
Upvotes: 1