Make sure to do all the work in a private repository and, once finished, invite the following people:
- https://github.com/broomburgo
- https://github.com/dani-mendez
- https://github.com/lucaangeletti-jobandtalent
- https://github.com/molmedo-jt
- https://github.com/rico-crescenzio
git clone [email protected]:jobandtalent/ios-take-home-project.git
cd ios-take-home-project
git remote set-url origin [email protected]:<your-private-repo>.git
git push
In case of questions, feel free to contact [email protected].
The MiniJobandtalent app consists of a simple list of jobs that you can apply to. The project code quality is far from ideal, and it’s your responsibility to fix it. Each step must be accomplished via a single commit, whose message must provide further explanations about the changes: we will review the project commit-by-commit, and will use the commit message as a guide to the code, so we expect that each commit message contains the number of the task and a description of the code that was added, removed or modified.
It's recommended that you read all the steps before starting. We really value, for reviewing purposes, that you stick to what it's asked for in each task: there is room for you to show off in the two final steps, where you'll be able to apply a particular architecture to the project, if you want.
Before executing the app, you must run the underlying server providing the static JSON data.
npm install -g json-server
json-server Minijobandtalent.json --port 8000
- The app crashes on startup. Figure out why and fix it.
- Fix the layout bug happening when applying to the first job.
- Can you discover the retain cycle hidden inside
JobListViewController
? Could you fix it? - Include some visual feedback inside
JobListViewController
while the information is loading. JobCell
notifies viaNotificationCenter
when applying to a job. What problems can you see with this solution? Implement a better one to propagate state changes using the current reference semantics.JobListViewController
relies on lifecycle methods likeviewWillAppear
to reflect the changes made in the detail view when coming back to the list. Come up with a different solution, so the list is refreshed instantly and reactively whenever a job is applied.- Change
Job
to be a value type without modifying the current app behavior. What are the main advantages and disadvantages of using value semantics for this case? - We want to show the number of applicants for each job. Due to backend under-the-hood caching issues, the applicants’ information is provided in a different API call from the following URL. Modify the app, so
JobCell
shows the correct number of applicants coming from the JSON. - Make the aforementioned applicants change when applying for a job.
URLSessionDataTask
API provides the following completion handler:(Data?, URLResponse?, Error?) -> Void)
. Can you see any problems with that handler input? Can you extend URLSession to provide a more typed-correct version?- Having types wrapping functions (like completion handlers) has great advantages, like allowing to provide some high-level constructions like
map
orflatMap
. Create a new container typeAsyncResult<T, E: Error>
that wraps a function like((Result<T, E>) -> Void) -> Void
and notifies you in case of success or failure. Implementmap
andflatMap
.
The main functions on AsyncResult<T, E: Error>
should have these signatures:
// within the definition of `AsyncResult<T, E: Error>`
init(_ run: ((Result<T, E>) -> Void) -> Void) {}
func map<U>(_ transform: (T) -> U) -> AsyncResult<U, E> {}
func flatMap<U>(_ transform: (T) -> AsyncResult<U, E>) -> AsyncResult<U, E> {}
Feel free to add @escaping
where required.
Please Note: the requirement is not to create a function with return type async -> Result<Success, Failure>
; we expect you to define an entirely new AsyncResult<T, E: Error>
type that handles asynchronous code internally.
- Extend
URLSession
API to returnAsyncResult
instead of providing completion handlers. - Implement a function like the following:
func chooseSomeName<T1, T2, E: Error>(_ first: AsyncResult<T1, E>, _ second: AsyncResult<T2, E>) -> AsyncResult<(T1, T2), E>
Use it to compute the information needed for the list screen to be rendered (the list of jobs and the number of applicants). How would you name this function?
- Extend the previous
AsyncResult
type with adelay
function, and use it to change the apply action to be an asynchronous operation that takes one second to complete and can never fail. JobListViewController
is currently pushingJobDetailViewController
on top of the navigation stack. What are the disadvantages of that approach? Provide a better API and future-proof solution to handle navigation more robustly, and to remove the direct navigation responsibility fromJobDetailViewController
.- Apply further cleanup so that you feel the code is production-ready. Move things around and apply the architecture you feel more comfortable with.
- Add enough testing to be able to apply changes to your code with confidence.