Skip to content

Conversation

@3a4oT
Copy link

@3a4oT 3a4oT commented Oct 19, 2025

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 3a4oT mentioned this pull request Oct 19, 2025
3 tasks
3a4oT added 6 commits October 25, 2025 21:18
- Updated DEVELOPER_DIR to Xcode_26.0.1 in all CI workflows
- Updated build.sh SDK from iphonesimulator17.4 to iphonesimulator26.0
- Updated simulator device from iPhone SE (3rd generation) to iPhone 17
- Updated actions/checkout from v2 to v4
- Changed runs-on from macos-latest to macos-15 for explicit versioning
- Verified all build configurations (framework, carthage, tests, examples)
Add comprehensive SPM support using Swift 6.2 package traits for modular features.

Core features:
- Package.swift with AsyncDisplayKit and TextureIGListKitExtensions products
- Default traits (Video, MapKit, Photos, AssetsLibrary) match CocoaPods defaults
- Optional IGListKit trait with pure Swift implementation
- TextNode2 (modern TextNode) enabled by default
- PINRemoteImage always included

IGListKit integration:
- Pure Swift implementation (traits don't work with Objective-C #if directives)
- ListAdapter.setCollectionNode(_:) replaces Objective-C setASDKCollectionNode:
- Uses IGListKit 5.0+ (breaking changes from 4.x in CocoaPods/Carthage)
- Runtime protocol conformance for ASCollectionDataSourceInterop

Infrastructure:
- SPM source layout generation script (scripts/generate_spm_sources_layout.swift)
- Symlinks from Source/ to spm/Sources/AsyncDisplayKit/
- Build script modes: spm-texture-basic and spm-texture-iglistkit
- CI jobs for both configurations with layout validation

Testing:
- SPMBasic example: 15 tests for core AsyncDisplayKit + PINRemoteImage
- SPMWithIGListKit example: 4 tests for IGListKit integration
- All tests passing

Documentation:
- README with usage examples and CocoaPods migration table
- CONTRIBUTING with SPM layout regeneration instructions
- Comprehensive TextureIGListKitExtensions guide

Reference implementations: Source/IGListAdapter+AsyncDisplayKit.mm,
Source/Private/ASIGListAdapterBasedDataSource.mm
- Add ASIGListKitSPM example demonstrating local package wrapper approach for iOS apps
- Update TextureIGListKitExtensions README with iOS/tvOS app integration guide
- Add spm-app-iglistkit build mode to test iOS app integration
- Improve SPM test strategy: spm-texture-basic tests committed files, spm-texture-iglistkit tests generation script
- Update example READMEs with clear documentation structure
- Change swift-tools-version from 6.2 to 6.1 in all Package.swift files
- Package Traits feature was introduced in Swift 6.1 (SE-0450)
- Update documentation to reflect Swift 6.1+ requirement
- Add Swift Package Manager badge to README
…s SPM traits

- Remove AssetsLibrary (deprecated iOS 9.0)
- Remove Video/MapKit/Photos traits that don't work with Swift via SPM
- Update documentation explaining SPM limitations with conditional compilation
- Recommend CocoaPods/Carthage for users needing these features

Technical details:
Objective-C classes wrapped in preprocessor conditionals (#if AS_USE_VIDEO)
are not exported in Swift module interface, making these traits non-functional
for Swift users even when enabled.

Tests: spm-texture-basic and spm-texture-iglistkit pass
- Add SupplementaryViewSourceMethods enum with viewForSupplementaryElement and sizeForSupplementaryView
- Replaces unavailable ASIGListSupplementaryViewSourceMethods for SPM users
- Comprehensive documentation with step-by-step examples
- Migration guide from Objective-C implementation

Fixes issue where ASIGListSupplementaryViewSourceMethods is inaccessible from Swift when using SPM with traits due to #if AS_IG_LIST_KIT wrapping.
3a4oT added 3 commits October 25, 2025 21:33
- Updated Package.swift to enhance SPM source distribution for Texture, including detailed documentation on IGListKit integration and limitations.
- Removed deprecated UICoreKit example, including its Package.swift, source files, and tests, to streamline the project.
- Added module.modulemap for AsyncDisplayKit to eliminate umbrella header warnings.
- Adjusted build settings in project.pbxproj to reflect the removal of UICoreKit and ensure proper integration of TextureIGListKitExtensions.
…nderstanding for developers integrating with iOS/tvOS projects.
@3a4oT
Copy link
Author

3a4oT commented Oct 27, 2025

@rcancro, hello, this PR should be ready for review, please let me know if this can be upstreamed?

…gration

- Removed the custom module.modulemap for AsyncDisplayKit to prevent issues with C++ headers, allowing SPM to generate its own automatically.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant