Skip to content

Simple Swift MVVM implementation to search TV shows using API without using any dependency.

Notifications You must be signed in to change notification settings

anamalihassan/SwiftMVVMSearchAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Search API Using MVVM with Swift

Design Pattern

  • I have used MVVM design pattern becuase it seprates UI from logic, seperate unit tests are easier and code is event driven.

Dependcies

  • No external Library is used.

Project Structure

  • Project is divided into respective folders as the folder name describes.
  • There are commons and helper folder which have global app constans and common utility functions.

Logic

  • By default, shows for search query "girl" are shown.
  • On cancel button press, no action is implemented as it depends upon requirements.
  • I have used backgroud image for table view in case there are no shows found which stays if you press cancel button. I would have implmeneted an animated view to show the message on top or bottom but due to time and simplicity, I avoided.
  • Image View is extended to handle download and cache image from URL
  • Search bar is shown as "on scroll" on purpose.
  • all views are added programmatically using autolayouts constraints.
  • Data is fetched from API service assuming URL is valid. In case of invalud URL error is shown.
  • Simple Loader is shown to save time.
  • View Model handles all the logic and notifies the view controller whenever data is fetched successfully or if there is an error.

Testing

  • I have included basic unit and UI tests as well.

About

Simple Swift MVVM implementation to search TV shows using API without using any dependency.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages