Places
June 18, 2019 ยท View on GitHub
Discussion
VIPER/MVVMhybrid design pattern utilized in the home screen.- Custom
in-memory cache-CRAMemoryCachewhich supportsstructs. - Custom
networkingimpelementation mimicsMoyain terms of public API. - An in-memory cache lives on the
2nd levelof the networking layer and caches the constructedhttpsresult objects. - By default
Apple'simplementation ofURLSessioncontains aURLCachewhich is internally managed by the caching policy returned from the server. This cache will also persist to disk which is the reason for my omitting adisk cacheimplementation. Assuming a correctly developedREST APIreturning proper header values,Apple'sURLCachewill appropriately manage the storing and purging of data. HTTPvsHTTPS- Both endpoints provided were non-secure with required the allowance ofarbitrary loadsin theXcodeproject settings. This is extremely unsafe as it exposes all traffic running through the app; however, as this is a non-production application I opted for allowing it. The other option is to set customsubdomainexceptions which could be an improvement on my implementation.
Known Issues
Cell dequeueing- In the home screen cell dequeueing causes issues where the embedded collection view looses track of its scroll position when it gets reused.
Improvements
Better logging- a custom logger could have come in extremely handy; however, considering the time frame I felt if was better if I omitted it.Error handling- error handling is crucial to a great application; however, it is often the bulk of the development effort. Errors in this project were handled by placeholders and fake data.Detail screen- 95% of my effort went into the home screen and the functionality involved with its features. Given more time I would have thought more about what information to provide the user and cleaned up the interface a bit.Sorting logic- There is a lot of redundant code here. The way the filters are applied is extremely static meaning that on the server-side, nothing can be done to add or remove filters and the applied behavior to the data. This boils down to the endpoints and how they are provided. Ideally you could request data from the server with a different filter parameter and receive already-filtered data to populate the collection with; however, with the provided static file, this was not a luxury that was able to be had. Filtering on-device was necessary so it required a less-than-ideal impelementation here.