In Swift Apprentice , P107(pdf, 4th edition):
func addItemViewController(controller: AddItemViewController, didFinishAddingItem item: ChecklistItem) {let newRowIndex = items.count items.append(item)
let indexPath = NSIndexPath(forRow: newRowIndex, inSection: 0)
let indexPaths = [indexPath]
tableView.insertRowsAtIndexPaths(indexPaths,withRowAnimation: .Automatic)
dismissViewControllerAnimated(true, completion: nil)
}
I am bit confused on the object:
for the sentence:
tableView.insertRowsAtIndexPaths(indexPaths,withRowAnimation: .Automatic)
it talks about the embedded object, that’s ChecklistItemViewController;
but for the sentence:
dismissViewControllerAnimated(true, completion: nil)
it talks about the delegating object, that’s AdditemViewController.
Why don’t I need to explicitly specify the object, like:
controller.dismissViewControllerAnimated(true, completion: nil)
or:
self. tableView.insertRowsAtIndexPaths(indexPaths,withRowAnimation: .Automatic)