Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 1.76 KB

File metadata and controls

24 lines (15 loc) · 1.76 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Getting Started

This is an iOS library for UITableView and UICollectionView adapters. To work with the project, you should familiarize yourself with the example application.

Running the Example App

  1. Navigate to the Example directory: cd Example
  2. Install the dependencies using CocoaPods: pod install
  3. Open the Xcode workspace: open Adaptor.xcworkspace
  4. Build and run the Adaptor-Example scheme on a simulator or device.

Architecture

The core of this library is the Adaptor pattern, which separates the data source and delegate logic from the view controller.

  • Adaptor.swift: Defines the core protocols (AdaptingProtocol, TableAdaptingProtocol, CollectionAdaptingProtocol) and base classes (TableAdaptor, CollectionAdaptor). It also includes the useAdaptor method, which is an extension on UITableView and UICollectionView to attach the adaptor.
  • Adaptor+UITableView.swift and Adaptor+UICollectionView.swift: These files contain the implementations of the UITableViewDataSource, UITableViewDelegate, UICollectionViewDataSource, and UICollectionViewDelegate methods. They delegate the logic to SectionViewHolder and CellViewHolder instances.
  • SectionViewHolders and CellViewHolders: These objects are responsible for managing the data and events for a specific section or cell. The Adaptor's dataSource is an array of SectionViewHolders, and each SectionViewHolder contains an array of CellViewHolders.

When working in this codebase, remember to keep the data and view logic separated by using the holder objects. New features should be implemented within this pattern.