Delegation
https://www.tutorialspoint.com/ios/ios_delegates.htm
You should do the following:
- Create a branch from develop, called feature/delegation.
- Add “+” button to
MainViewController
in navigation bar, created asUIBarButtonItem
. - 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. - Add a handler for “+” button so it shows
CreateEmployeeViewController
. - Add “Save” button to the navigation bar of
CreateEmployeeViewController
, which reads the text fields, creates a new instance ofEmployee
, returns it toMainViewController
and is added to the current organization. Table view ofMainViewController
should be reloaded and should display newly created employee. Use the delegation pattern. - 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?