The code is divided into three parts:
Venues
projectComponents
frameworkPackages
dependencies usingSwiftPackages
The reason behind it is to keep the components away from the main app, plus they don't have to be compiled every time there's a change in Venues
.
All the components and the main view controller are made with constraints created by code. The main reason is to reduce the number of files, as well as making much simpler to deal with any possible conflicts. Also, it is much easier to maintain, and expand.
Few things are missing:
- Extract all the layout logic into a
Layout.swift
, where pinning tosuperview
is afunc
away - Improving the performance of
ImageDownloader
. Though it is usingSDWebImage
, the scrolling is not ideal - Add UI tests for the
VenuesViewController
to test different scenarios (i.e. retry button when the network is offline) - Sort upcoming venues by date
- Separate upcoming venues by month
It would be ideal to have support for offline mode, so the No connection error is not shown. Instead, the venues are stored locally using CoreData
Sorting several venues locally, and then dividing them by month is a costly operation, and it would have to be replicated for each platform (i.e. web, android). Instead, the back-end could:
- Provide venues already sorted by date
- Provide venues already divided into sections (more below)
- Allow to lazily fetch more venues
The back-end can easily provide venues in the following manner:
{
"sections": [
{
"date": "2021-06-18",
"venues": [ // Where venues are already sorted by date
{
"image_url":"https://images.unsplash.com/photo-1582642017153-e36e8796b3f8",
"cost": "free",
"location": "The Penny Farthing",
"venue": "Manhattan",
"start_time": "2021-06-18T17:00:00Z",
"end_time": "2021-06-18T22:00:00Z"
}
]
}
]
}