A UIKit iOS app with MVP architecture utilizing IoC and DI
Clean MVP
POW-dark.mp4
Requirements:
Functional:
- Fetching and parsing data from API.
- Listing Data.
- Searching.
- Pagination.
- Navigation to Details view.
Non-Functional:
-
Performance:
- Caching images.
-
Scalability:
- Modularity.
-
Reliability:
- Unit tests.
Low-Level Design
Design Decisions
-
UI:
- UIKit
- MVP Architecture
-
Principals and Patterns:
- SOLID conformance:
- Features are separated into modules.
- UseCases for business logic.
- Utilizing IoC and DI.
- Coordinator pattern for navigation.
- SOLID conformance:
-
Dependency Manager:
- Swift Package Manager (SPM)
-
Dependencies:
- Kingfisher: Downloading and caching images from the web.
Notes:
- Design Patterns:
- Bridge Design Pattern (
BaseVC
andBasePresenter
) is used to avoid code duplication. - Adapter Design Pattern (
HTTPClient
andWatchlistDataStore
) is used to easily swap HTTP clients or Data Persistence if needed (ex.Alamofire
instead ofURLSession
). - Composite Reuse Principle (CRP) (
DataSources
andDelegates
) is used to compose theViewControllers
. - An Automatic DI Container (Resolver or Swinject) could be used if the project got bigger.
- Repository Pattern could be used if local data storage is needed in the future.
- Bridge Design Pattern (
- iOS APIs:
- DispatchGroup (
SimilarMoviesUseCase
) is used to handle multiple async network calls. - Race Conditions are avoided in
SimilarMoviesUseCase
using a serialDispatchQueue
. - A Set is used over an Array in
WatchlistDataStore
to achieveO(1)
search time complexity.
- DispatchGroup (
- To achieve better UX:
ActivityIndicator
for each network called is used.Debouncer
is used to avoid unneeded search results and UI refreshes.- DarkMode and Landscape modes are supported.
- Errors are handled to avoid failing silently.
- Different placeholders are used for different image types (poster or cast).
- All the presenters are unit tested (15 tests in total).