This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
RxPullToRefresh — RxSwift ベースの pull-to-refresh ライブラリ (iOS 13+, Swift 5.9+, RxSwift 6)。配布は SPM のみ (CocoaPods/Carthage は v2.0.0 で廃止)。
シミュレータ名・ID は環境依存。xcrun simctl list devices available で確認して差し替える。
# 単体テスト (Quick/Nimble、シミュレータ必須)
xcodebuild test -project RxPullToRefresh.xcodeproj -scheme RxPullToRefresh \
-destination 'platform=iOS Simulator,name=iPhone 16' -only-testing:RxPullToRefreshTests
# 単一 spec クラスのみ
xcodebuild test ... -only-testing:RxPullToRefreshTests/AnimatorSpec
# UI テスト (Example アプリ起動、重い)
xcodebuild test -project RxPullToRefresh.xcodeproj -scheme RxPullToRefresh \
-destination '...' -only-testing:RxPullToRefreshUITests
# framework / Example ビルド
xcodebuild build -project RxPullToRefresh.xcodeproj -scheme RxPullToRefresh -destination 'generic/platform=iOS Simulator'
xcodebuild build -project RxPullToRefresh.xcodeproj -scheme RxPullToRefreshExample -destination 'generic/platform=iOS Simulator'
# Lint
swiftlint lint
# DocC (CI が master push で GitHub Pages へデプロイ)
xcodebuild docbuild -project RxPullToRefresh.xcodeproj -scheme RxPullToRefresh -destination 'generic/platform=iOS Simulator'Package.swift= ライブラリ配布用 (target はSources/のみ)。ルートに xcodeproj が同居するため、この dir でのxcodebuild -schemeは xcodeproj を拾う。SPM 側の検証はローカルパス依存の消費側パッケージを別 dir に作って行うRxPullToRefresh.xcodeproj= 開発用。4 target (framework / Tests / Example / UITests)。依存は SPM package reference (RxSwift, Quick, Nimble, RxDataSources)。pbxproj は手編集されている — package 追加時は XCRemoteSwiftPackageReference / XCSwiftPackageProductDependency / packageProductDependencies / PBXBuildFile(productRef) の 4 箇所をセットで触る
- コア
RxPullToRefreshクラスは機能別に extension 分割:+Core.swift(KVO 監視・スクロール処理)、+Refreshing.swift(状態遷移)、+Rx.swift(Reactive extension) - UIScrollView への公開 API は
p2r名前空間経由 (UIScrollView+P2R.swiftのRxPullToRefreshProxy) - Rx 連携は 2 系統: KVO (
observeWeakly) ベースの ControlProperty/Driver 群と、RxPullToRefreshDelegateをDelegateProxy(RxCocoa) でラップしたrx.action RxPullToRefreshViewはユーザーがサブクラス化する表示コンポーネント。action(state:progress:scroll:)の override 必須 (基底実装は fatalError)- UITests target はアプリ本体をリンクせず Example のソースを再コンパイルして
@testable import RxPullToRefreshExampleする方式。Example のビルド設定変更時は UITests too
- Quick 7 形式:
override class func spec()(instance spec() は Quick 6+ で廃止)。self.continueAfterFailureは class func 内で使用不可 - Nimble 13:
toEventually(..., timeout: .seconds(N))— 数値リテラル不可 - UITests は 1 ケース 40〜60 秒 × 17 = 約 14 分。
-derivedDataPathを明示しないと外部の Xcode 操作で成果物が消えCannot launch simulated executableになる - Example は
UITableViewController+ storyboard outlet で delegate が二重配線される。rx.setDelegateの前にdelegate/dataSourceを nil にしないと RxCocoa の assert で落ちる (Debug ビルドのみ発火)
ci.yml: push/PR (master, develop) で unit tests + Example build + SwiftLint。UI tests は master push とworkflow_dispatchのみ (所要 15 分)docs.yml: master push で DocC → GitHub Pages (Pages source を「GitHub Actions」に切り替えてある前提)release.yml:2.0.0形式のタグ push で CHANGELOG の該当セクションを抽出して GitHub Release を作成- SwiftLint は macOS runner に同梱されないため ubuntu +
ghcr.io/realm/swiftlintコンテナで実行する