Texture icon indicating copy to clipboard operation
Texture copied to clipboard

Swift Package Manager Support with IGListKit Integration

Open 3a4oT opened this issue 4 months ago • 1 comments

Summary

This PR adds Swift Package Manager support for Texture with IGListKit integration.

Changes

Package.swift:

  • Add SPM manifest with source distribution
  • Support for AsyncDisplayKit and TextureIGListKitExtensions products
  • IGListKit integration disabled at compile-time (AS_IG_LIST_KIT=0) for source builds
  • Dependencies: PINRemoteImage 3.0.4, IGListKit 5.0.0
  • Traits approach was explored but removed due to limitations with Objective-C/C++ mixed packages

TextureIGListKitExtensions module:

  • Pure Swift wrapper for IGListKit integration
  • Provides adapter.setCollectionNode(node) as Swift-friendly alternative to Objective-C setASDKCollectionNode:
  • Runtime conformance to ASCollectionDataSourceInterop/ASCollectionDelegateInterop protocols
  • Updated for IGListKit 5.0+ (uses allowsBackgroundDiffing instead of removed allowsBackgroundReloading)

Build infrastructure:

  • SPM source layout generator script with automatic module.modulemap generation
  • Eliminates umbrella header warnings for private headers
  • Build script modes: spm-texture-basic, spm-texture-iglistkit, spm-app-iglistkit
  • CI workflow updates for Xcode 16.4

Examples:

  • SPMBasic - Basic SPM integration test
  • SPMWithIGListKit - Library package with IGListKit
  • ASIGListKitSPM - iOS app example

Why Swift wrapper is needed

SPM cannot export Objective-C categories on classes from external modules. The original IGListAdapter+AsyncDisplayKit category extends IGListAdapter from the IGListKit module, which SPM source builds cannot compile. The Swift implementation provides the same functionality while working within SPM's constraints.

Design decisions

Traits approach: Initially explored using SPM traits for optional IGListKit support, but this was removed because:

  • Traits don't work with Objective-C conditional compilation (#if directives)
  • Mixed Objective-C/C++ codebases have module map limitations with traits
  • Simpler user experience: just import TextureIGListKitExtensions when needed

IGListKit always available: IGListKit dependencies are included but compile-time flags are disabled (AS_IG_LIST_KIT=0), allowing users to opt-in via the Swift wrapper module.

3a4oT avatar Oct 19 '25 15:10 3a4oT