Skip to content

chriscamed/HatchworksChallenge-iOS

Repository files navigation

Hatchworks Challenge – iOS

This project is a native iOS application developed as part of a coding challenge. It demonstrates a clean, modern architecture using the latest Apple frameworks and development practices, without relying on any third-party libraries.

Overview

The app displays a grid of photos retrieved from the public Picsum Photos API, which does not require any API key. Users can scroll through a masonry layout and tap on an image to view its detail with a smooth transition animation.

If the device is offline, previously fetched data is loaded from the local SwiftData store as a fallback.

Architecture

  • Clean Architecture with clear separation between Domain, Data, and Presentation layers.
  • MVVM (Model–View–ViewModel) pattern for UI management and data binding.
  • Repository pattern for abstracting data sources (network + local persistence).
  • Use Cases encapsulate application-specific business logic.

Design

  • Built entirely with SwiftUI using declarative, reactive UI principles.
  • Masonry-style photo grid with adaptive columns and pagination.
  • Matched geometry animations for transitioning between list and detail views.
  • Smooth bounce and fade-in animations when images load.

Technologies

  • Xcode: 16.2
  • Deployment version: iOS 18.2
  • Language: Swift 6
  • UI Framework: SwiftUI
  • Local Persistence: SwiftData
  • Networking: URLSession (no external library)
  • Testing:
    • Swift Tests for unit and integration testing (repository, use case, and view model).
    • XCUITest for UI automation (grid rendering, pagination, and overlay transitions).

Endpoint

The app uses the open Picsum Photos endpoint:

https://picsum.photos/v2/list?page={page}&limit={limit}

This endpoint returns a JSON list of photo objects containing author name, dimensions, and URLs for downloading images. No authentication or API key is required.

Running the App

  1. Open the project in Xcode 16 or newer.
  2. Select the HatchworksChallenge-iOS scheme.
  3. Choose an iOS simulator (iPhone 15 or newer recommended).
  4. Run the app (Cmd + R).

The app will fetch and display the first page of photos. Scrolling to the bottom automatically triggers pagination. Tapping on any image opens the detail view with an animated expansion.

Testing

To run all tests:

Cmd + U

This executes both unit tests and UI tests. UI tests include checks for:

  • Initial grid rendering
  • Infinite scrolling pagination
  • Overlay transition and close behavior

Screenshots

Below are a few screenshots of the app in action:

Grid View Detail View Offline Mode
Grid View Detail View Offline Mode

These images demonstrate the masonry layout, smooth transition animation, and SwiftData offline persistence.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages