I have created a picker programmatically in code, in a view controller.
In viewDidLoad, I set
picker!.delegate = self
picker!.dataSource = self
And creates all functions to conform to UIPickerViewDataSource, UIPickerViewDelegate
Works perfectly. Picker displays, with the content defined in an array ; allows for selection…
So, for testing, I commented out picker!.dataSource = self
I thought that would not work anymore.
Surprise, it still works the same !
I tested with the log:
print(picker!.delegate)
print(picker!.dataSource)
and got
Optional(<simpleTest.SelectCellFromItem2ViewController: 0x7f928982ee00>)
nil
So, dataSource is nil.
How can this work ?
Does it mean that when no dataSource is defined, delegate is used by default ?