Pick the fix
A custom picker needs its owner to supply the row count, each row's title, and to hear about selection. Which pattern?
Hint 1 of 1
How many related callbacks are there?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A A weak delegate or data source protocol
Correct. It's one owner and several related callbacks.
Why not the others?
- B A single closure. One closure can't cleanly answer several different questions.
- C NotificationCenter. It's one-to-many and untyped, and can't return values.
- D Subclass the picker for every use. That couples behaviour to inheritance.