Skip to content

Simple Rick and Morty Character listing using clean + mvvm for arch.

Notifications You must be signed in to change notification settings

Mostafa3la2/RickAndMortyCharacters

Repository files navigation

Rick and Morty Characters App

Swift Platform

Overview

This iOS application fetches and displays character data from the Rick and Morty API. The app is designed to showcase a clean architecture approach, making the codebase modular, scalable, and testable. Users can browse through a paginated list of characters and view detailed information about each character.

Technologies Used

  • Swift: The primary programming language used for developing the app.
  • UIKit & SwiftUI: Utilized for building the user interface.
  • Combine: Used for handling asynchronous events and data binding.
  • Clean Architecture: Implements the clean architecture principles to maintain a clear separation of concerns.
  • Dependency Injection: Used for managing dependencies and enhancing testability.
  • Kingfisher: Used for image caching.
  • SkeletonView Add more user-friendly loading style in poor connection situations

Why Clean Architecture

Clean Architecture was chosen to ensure that the app is modular, testable, and maintainable. while it might seem to be an overkill for such a simple task, I think such task typically would be a part of a larger app that should follow this architecture like IMDB, Fextralife, etc, This approach provides several benefits as following:

  • Separation of Concerns: Each layer has a distinct responsibility, making the codebase easier to understand and maintain.
  • Testability: The architecture allows for easier unit and integration testing by decoupling components that can be mocked individually to increase code coverage
  • Scalability: The modular structure makes it easier to add new features without impacting existing functionality.
  • Flexibility: Components can be easily replaced or updated without affecting other parts of the system.

Assumptions

  • Characters are colored in homepage based on their status as following: blue for alive, peach for dead, white for unknown
  • filteration happens at API level not on the current character list
  • Used Xib files for UIKit instead of designing by code as there are already some SwiftUI views writted by code to showcase diversity in creating UI
  • Details don't need to be refetched from remote source as the model itself in homepage has the full details and doesn't have a simplified version
  • Used the default urlsession because we don't need any additional customization as no features like SSL pinning are implemented.
  • Minor UI enhancements like adding shadow to back button in details page to increase visibility and adding pull to refresh logic

Challenges Faced

  • Separation of concers while designing with clean architecture i.e. having multiple mappers between models
  • Choosing what to make mockable and testable
  • Dependency Injection Container logic, coordinator logic.
  • Pagination Unit testing.

Possible Enhancements

  • Enhance network layer to have logging and better error handling
  • Adding system for handling accessbility identifier and adding more UI Tests

Screenshots

Screenshot 2024-07-08 at 05 34 15 Screenshot 2024-07-08 at 05 34 15 Screenshot 2024-07-08 at 05 34 15 Screenshot 2024-07-08 at 05 34 15 Screenshot 2024-07-08 at 05 34 15

Getting Started

Prerequisites

  • Xcode 15.0 or later
  • iOS 16.0 or later

Installation

  1. Clone the repository:
    git clone https://github.com/Mostafa3la2/RickAndMortyCharacters.git

About

Simple Rick and Morty Character listing using clean + mvvm for arch.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages