This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is an iOS library for UITableView and UICollectionView adapters. To work with the project, you should familiarize yourself with the example application.
- Navigate to the
Exampledirectory:cd Example - Install the dependencies using CocoaPods:
pod install - Open the Xcode workspace:
open Adaptor.xcworkspace - Build and run the
Adaptor-Examplescheme on a simulator or device.
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 theuseAdaptormethod, which is an extension onUITableViewandUICollectionViewto attach the adaptor.Adaptor+UITableView.swiftandAdaptor+UICollectionView.swift: These files contain the implementations of theUITableViewDataSource,UITableViewDelegate,UICollectionViewDataSource, andUICollectionViewDelegatemethods. They delegate the logic toSectionViewHolderandCellViewHolderinstances.SectionViewHolders andCellViewHolders: These objects are responsible for managing the data and events for a specific section or cell. TheAdaptor'sdataSourceis an array ofSectionViewHolders, and eachSectionViewHoldercontains an array ofCellViewHolders.
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.