Kodeco Forums

Swift 2 Tutorial Part 3: Tuples, Protocols, Delegates, and Table Views

Learn about Tuples, Protocols, Delegates, Table Views, and playground prototyping in this hands-on Swift 2 tutorial!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1568-swift-2-tutorial-part-3-tuples-protocols-delegates-and-table-views

Hi Ray, thanks for this tutorial & your whole site which is invaluable. I’m writing my first game exercise. Your protocol/delegate explanation is the first one I’ve read that makes sense. If you can clarify something that would be great.

  1. wrt the simulator example recast into game situation, where is the best/correct place to declare the protocol? Is it in the ViewController or parent views or subviews?

  2. at what point should dateSimulatorDidStart() be called again in a game situation? It seems very clear when dateSimulatorDidEnd() would be called. But if the ViewController’s viewDidLoad() or viewWillLayoutSubviews() are going to set up a game board and then waits for the first tap by the user, where does dateSimulatorDidStart() come in?

Thanks