Employees App is a simple app that fetches a list of employees from a un-authorized
endpoint and shows the results in a TableView.
The scode was reduced to iPhones and the device orientation as Portrait
The UI was built programmatically with UIKit.
It is the object factory of the app, it helps instanctiating
ViewControllers, Services, etc. It also stores of global services or variables if they need to be persisted when the app
One usage example is when presenting a new view controller, the
AppFactoryContainer can be called like the following:
let newViewController = AppFactoryContainer.makeViewController() self.present(newViewController)
makeViewControllerwill create the the new View Controller while injecting all of its depedencies.
This is the main and only view controller of this app.
mainView: it is a view object that contains all the elements of the ui.
model: data of the tableView
It consumes the corresponding newtorking services to fetch
the data from servers whenever is required, plus it is binded
to the UI to show the changes of data.
It is a service that uses the
GenericNetworkServiceunder the hood and it fetches the list of employee from the servers.
It is a service that deals with the image caching.
It is a service that helps downloading images.
It is a static class that has some methods with generic parameters that it is being used to request data from servers.
Other relevant points:
Steps to run the app:
It doesn’t have any cocoa libraries so it is just download and play.
What areas of the app did you focus on?
What was the reason for your focus? What problems were you trying to solve?
The idea was to create an app easy to maintain, testable, efficient.
I also considered SOLID principles.
How long did you spend on this project?
Around 6 hours
Did you make any trade-offs for this project? What would you have done differently with more time?
I could implement something fancier for the indenpency injection, like having a dependency container, a resolver, service locator…
I could have refactored the TableViewCell, I didn’t finish its MVVM implementation, it looks a little bit mixed up.
What do you think is the weakest part of your project?
I wasn’t sure if the project required the images to be stored in a persistant storage or simply in memory. In any case, I could implemented if it is required.
Normally I use memory cache for simple projects but I can use coredata if is needed or I could use the Kingfisher library.
Did you copy any code or dependencies? Please make sure to attribute them here!
I used an small helper class to implement reflection in swift for the some unit tests.