Make an TVOS app with Swift/UIKit that the user can see an grid of popular photos from Flickr with infinite scrolling and search.
The api_key from Flickr on this project are deleted, you need to generate a new own and put on FlickrURLBuilder/apiKey
- Create XCode Project
./.tuist-bin/tuist generate
or just
make project
Witch this architecture features are decopladed, so the grid screen itself don't knows who is populating the information, just sent the events.
One improvement to make on this project is create a Service Locator to register cross-modules dependencies to make router's less repetitive and improve dependency management, like https://github.com/Swinject/Swinject library:
final class FlickrTradingTopRoute {
@Inject var service: FlickrService
@Inject var imageLoader: ImageLoader
static func makeViewController() -> UIViewController {
let adapter = GridAdapter<GridCellViewModel>()
let grid = GridViewController(
viewModel: FlickrTrandingTopGridViewModel(
adapter: adapter,
fetchPagedGridUseCase: FetchPagedFlickrGridPhotosUseCase(service: service),
imageUseCaseFetchable: FetchImageUseCase(
imageLoader: imageLoader
),
searchPagedGridUseCase: FetchPagedSearchFlickrPhotosUseCase(
service: service
)
)
)
grid.title = "Feed"
return grid
}
}
And register the correct implementation on the app startup
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
//....
func registerDependencies() {
Container.shared.register({ solve in FlickrServiceImpl(service: solve()) }, for: FlickrService.self)
///...
}
}
Another thing that can be improved is split the libraries in Two different target's (LibInterface and Lib) on Interface will just have protocols and another public stuff that any module can use without comprimise the decoupling. On the other module is the default implementation that can be replaced on future only changing the glue-layer (aka: AppDelegate).
And Split UseCases in another module to re-use them in multiple target's