Skip to content

Liandas/JPHDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JPHDemo

JPHDemo is an iOS application that fetches and displays user details in a list format. This project is an MVVM demo project which shows basic implementation on MVVM design pattern on UIKit project. The app follows the MVVM (Model-View-ViewModel) architecture and uses UIKit for the user interface. It also supports user interaction features like opening websites, calling phone numbers, sending emails, and opening addresses in Apple Maps.

Features

  • Fetch users from a remote API (https://jsonplaceholder.typicode.com/users).
  • Display user details in a UITableView.
  • Show detailed information when a user is selected.
  • Perform actions based on user details (call, email, open website, open maps) with a confirmation alert.
  • Unit tests to validate network requests and ViewModel logic.

Run Unit Tests

The project includes unit tests to validate ViewModel logic and network interactions.

Run Tests in Xcode.

Open Xcode and go to Product > Test (Cmd + U).

Test Suite Purpose
UserListViewModelTests Tests if ViewModel correctly works.
UserRepositoryTests Ensures that the repository fetches users
UserDetailListViewModelTests Tests if ViewModel correctly works.

MVVM Architecture Breakdown

The app follows MVVM to separate concerns:

  • Model (User, UserDetail): Represents data structures.

  • ViewModel (UserListViewModel, UserDetailViewModel): Handles business logic and provides data to views.

  • View (UserListViewController, UserDetailViewController): Displays UI elements and receives user interactions.

  • Repository (UserRepositoryImpl): Fetches data from an API, keeping ViewModel independent from networking.

  • Network (NetworkServiceImp): Handles requests. (API)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages