Skip to content

Commit 136e47f

Browse files
committed
Remove deprecated AssetsLibrary and non-functional Video/MapKit/Photos 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
1 parent 68ad15d commit 136e47f

File tree

4 files changed

+50
-65
lines changed

4 files changed

+50
-65
lines changed

Package.swift

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,7 @@ let package = Package(
3333
)
3434
],
3535
traits: [
36-
// Default traits - enabled by default for backwards compatibility with CocoaPods
37-
.default(enabledTraits: [
38-
"Video",
39-
"MapKit",
40-
"Photos",
41-
"AssetsLibrary"
42-
]),
43-
44-
// Define all traits with descriptions
45-
.init(name: "Video", description: "Video node support with AVFoundation and CoreMedia"),
46-
.init(name: "MapKit", description: "MapKit integration for map nodes"),
47-
.init(name: "Photos", description: "Photos framework support"),
48-
.init(name: "AssetsLibrary", description: "Legacy AssetsLibrary support (iOS only)"),
49-
50-
// Optional traits - must be explicitly enabled
36+
// Optional traits
5137
.init(name: "IGListKit", description: "IGListKit integration for advanced collection view support")
5238
],
5339
dependencies: [
@@ -65,20 +51,22 @@ let package = Package(
6551
path: "spm/Sources/AsyncDisplayKit",
6652
publicHeadersPath: "include",
6753
cSettings: [
68-
// PINRemoteImage is always available
54+
// Always available features
6955
.define("AS_PIN_REMOTE_IMAGE", to: "1"),
7056

7157
// Disable old TextNode by default for SPM
7258
.define("AS_ENABLE_TEXTNODE", to: "0"),
7359

7460
// Trait-based conditional defines
75-
.define("AS_USE_VIDEO", to: "1", .when(traits: ["Video"])),
76-
.define("AS_USE_MAPKIT", to: "1", .when(traits: ["MapKit"])),
77-
.define("AS_USE_PHOTOS", to: "1", .when(traits: ["Photos"])),
78-
.define("AS_USE_ASSETS_LIBRARY", to: "1", .when(traits: ["AssetsLibrary"])),
7961
.define("AS_IG_LIST_KIT", to: "1", .when(traits: ["IGListKit"])),
8062
.define("AS_IG_LIST_DIFF_KIT", to: "1", .when(traits: ["IGListKit"])),
8163

64+
// Disabled features
65+
.define("AS_USE_VIDEO", to: "0"), // Not accessible from Swift via SPM
66+
.define("AS_USE_MAPKIT", to: "0"), // Not accessible from Swift via SPM
67+
.define("AS_USE_PHOTOS", to: "0"), // Partially accessible from Swift via SPM
68+
.define("AS_USE_ASSETS_LIBRARY", to: "0"), // Deprecated iOS 9.0, use Photos framework
69+
8270
// Always disabled for SPM
8371
.define("IG_LIST_COLLECTION_VIEW", to: "0"),
8472

@@ -115,13 +103,10 @@ let package = Package(
115103
.headerSearchPath("tvOS")
116104
],
117105
linkerSettings: [
118-
.linkedFramework("AVFoundation", .when(traits: ["Video"])),
119-
.linkedFramework("CoreMedia", .when(traits: ["Video"])),
120-
.linkedFramework("CoreLocation", .when(traits: ["MapKit"])),
121-
.linkedFramework("MapKit", .when(traits: ["MapKit"])),
122-
.linkedFramework("Photos", .when(traits: ["Photos"])),
123-
.linkedFramework("AssetsLibrary", .when(platforms: [.iOS], traits: ["AssetsLibrary"])),
124106
.linkedLibrary("c++")
107+
// Note: Video/MapKit/Photos frameworks not linked by default
108+
// These features are not accessible from Swift via SPM due to conditional compilation
109+
// Use CocoaPods or Carthage if you need these features, or use Objective-C code
125110
]
126111
),
127112
.target(

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,23 @@ targets: [
4141
```
4242

4343
**Default Features (included automatically):**
44-
- Core AsyncDisplayKit (ASDisplayNode, ASImageNode, ASTextNode, etc.)
44+
- Core AsyncDisplayKit (ASDisplayNode, ASImageNode, ASTextNode2, ASButtonNode, etc.)
4545
- PINRemoteImage integration (ASPINRemoteImageDownloader)
46-
- Video support (AVFoundation, CoreMedia)
47-
- MapKit integration
48-
- Photos framework
49-
- AssetsLibrary (iOS only)
46+
- Collection views (ASCollectionNode, ASTableNode)
47+
- Layout specs (ASStackLayoutSpec, ASInsetLayoutSpec, etc.)
48+
- TextNode2 (modern text rendering, replaces legacy TextNode)
5049

51-
**No trait configuration needed** - all these features work out of the box!
50+
**Optional Features (enable via traits):**
51+
- IGListKit integration (advanced collection views with modern Swift API)
52+
53+
**⚠️ SPM Limitations:**
54+
Video (ASVideoNode), MapKit (ASMapNode), and Photos features are **not available** via Swift Package Manager due to technical limitations. These Objective-C classes are wrapped in conditional compilation directives (`#if AS_USE_VIDEO`) which prevents them from being exported in the Swift module interface.
55+
56+
**If you need Video/MapKit/Photos features:**
57+
- Use **CocoaPods** or **Carthage** (full feature support)
58+
- Or use these features from **Objective-C code** (.m files)
59+
60+
**Future directions:** We're exploring solutions like Swift wrapper modules (TextureVideoExtensions, TextureMapKitExtensions) to provide Swift API for these features via SPM.
5261

5362
#### Advanced Usage: IGListKit Integration
5463

@@ -95,16 +104,18 @@ If you're migrating from CocoaPods, here's how the subspecs map to SPM features:
95104
|---------|-----------|-----|-------|
96105
| **Core** | `pod 'Texture'` (default) | `.product(name: "AsyncDisplayKit", ...)` | ✅ Always included |
97106
| **PINRemoteImage** | Included by default | Always included | ✅ Same behavior |
98-
| **Video** | Included by default | Default trait (enabled) | ✅ Same behavior |
99-
| **MapKit** | Included by default | Default trait (enabled) | ✅ Same behavior |
100-
| **Photos** | Included by default | Default trait (enabled) | ✅ Same behavior |
101-
| **AssetsLibrary** | Included by default | Default trait (enabled) | ✅ Same behavior |
102-
| **IGListKit** | `pod 'Texture/IGListKit'` | Trait + product (see above) | ⚠️ Uses IGListKit 5.0+ |
107+
| **Video** | Included by default | **Not available** | ❌ SPM limitation (see above) |
108+
| **MapKit** | Included by default | **Not available** | ❌ SPM limitation (see above) |
109+
| **Photos** | Included by default | **Not available** | ❌ SPM limitation (see above) |
110+
| **AssetsLibrary** | Included by default | **Removed** | ❌ Deprecated iOS 9.0, use Photos |
111+
| **IGListKit** | `pod 'Texture/IGListKit'` | Optional trait + product | ⚠️ Uses IGListKit 5.0+ |
103112
| **TextNode2** | `pod 'Texture/TextNode2'` | Enabled by default | ✅ Modern TextNode used |
104113
| **Yoga** | `pod 'Texture/Yoga'` | Not supported | Add as separate dependency |
105114

106115
**Key differences:**
107116
- **TextNode2 is default**: SPM uses the modern TextNode implementation automatically (no legacy TextNode)
117+
-**Video/MapKit/Photos not available**: Due to Swift Package Manager limitations with conditionally compiled Objective-C classes
118+
-**AssetsLibrary removed**: Deprecated in iOS 9.0, use Photos framework instead
108119
- ⚠️ **IGListKit version**: SPM uses IGListKit 5.0+ instead of 4.x (breaking changes)
109120
- ℹ️ **Yoga**: Not integrated in SPM - add Yoga as a separate dependency if needed
110121

examples/SPMBasic/README.md

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,25 @@
11
# SPM Basic Example
22

3-
This example demonstrates basic Texture usage via Swift Package Manager with default traits.
3+
This example demonstrates basic Texture usage via Swift Package Manager.
44

5-
## Features
5+
## What This Tests
66

7-
This example uses Texture with default traits enabled:
8-
- Video support (AVFoundation, CoreMedia)
9-
- MapKit integration
10-
- Photos framework
11-
- AssetsLibrary (iOS only)
7+
This example verifies that core Texture functionality works via SPM:
8+
- Basic nodes (ASDisplayNode, ASImageNode, ASTextNode, ASButtonNode)
9+
- Collection views (ASCollectionNode, ASTableNode)
10+
- Layout specs (ASStackLayoutSpec, ASInsetLayoutSpec, ASCenterLayoutSpec, ASBackgroundLayoutSpec)
11+
- PINRemoteImage integration (ASPINRemoteImageDownloader, ASNetworkImageNode)
1212

13-
## Building
13+
## SPM Limitations
1414

15-
From this directory:
15+
**Note:** Video (ASVideoNode), MapKit (ASMapNode), and Photos features are **not available** via SPM due to Swift Package Manager limitations with conditionally compiled Objective-C classes. These features remain available via CocoaPods and Carthage.
1616

17-
```bash
18-
swift build
19-
```
17+
## Running Tests
2018

21-
## Running
19+
From the repository root:
2220

2321
```bash
24-
swift run
22+
./build.sh spm-texture-basic
2523
```
2624

27-
Expected output:
28-
```
29-
✓ Texture (AsyncDisplayKit) imported successfully via SPM!
30-
Creating basic nodes...
31-
✓ ASDisplayNode created
32-
✓ ASImageNode created
33-
✓ ASTextNode created
34-
35-
✅ All basic Texture features are working with SPM!
36-
Default traits enabled: Video, MapKit, Photos, AssetsLibrary
37-
```
25+
This will build and run all tests to verify core Texture functionality works correctly with SPM.

examples/SPMBasic/Tests/DefaultTraitsTests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import AsyncDisplayKit
44

55
/// Tests that verify basic Texture functionality works via SPM
66
///
7-
/// Note: Default traits (Video, MapKit, Photos, AssetsLibrary) are enabled,
8-
/// but trait-specific Objective-C classes may not be accessible from Swift
9-
/// without additional bridging. These tests focus on core Texture functionality.
7+
/// Note: Video/MapKit/Photos features are not available via SPM due to Swift Package Manager
8+
/// limitations with conditionally compiled Objective-C classes (#if guards).
9+
/// These features remain available via CocoaPods and Carthage.
10+
/// These tests focus on core Texture functionality that works with SPM.
1011

1112
@Suite("Basic Texture Nodes")
1213
struct BasicTextureNodesTests {

0 commit comments

Comments
 (0)