ar.kalmykov created page: delegation authored by Artem Kalmykov's avatar Artem Kalmykov
# Delegation
https://www.tutorialspoint.com/ios/ios_delegates.htm
## You should do the following:
1. Create a branch from develop, called feature/delegation.
2. Add “+” button to `MainViewController` in navigation bar, created as `UIBarButtonItem`.
3. Create a new view controller called `CreateEmployeeViewController`, which should contain 3 text fields - first name, last name and salary - a label next to each one, describing what those text fields are.
4. Add a handler for “+” button so it shows `CreateEmployeeViewController`.
5. Add “Save” button to the navigation bar of `CreateEmployeeViewController`, which reads the text fields, creates a new instance of `Employee`, returns it to `MainViewController` and is added to the current organization. Table view of `MainViewController` should be reloaded and should display newly created employee. Use the delegation pattern.
6. Create a pull request from your branch to develop.
## You should be able to answer the following questions:
* What is a protocol?
* What is the difference between required and optional methods?
* May protocols be inherited?
* What is a weak property? Why is it commonly used with delegates?
* What are the options of reloading data in a table view?
* Are there any other ways of passing the data, except of delegation?