XIB Investigation Report - SPM Class Resolution Issue
Investigation Summary
I have thoroughly investigated the XIB bundling and class resolution issue. Here are my findings:
✅ What's Working Correctly
1. XIB File Configuration
GOOD NEWS: The XIB files are configured correctly!
MyRewardsBannerOffersScrollTableViewCell.xib:
<tableViewCell ... customClass="MyRewardsBannerOffersScrollTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
ProfileHeaderTableViewCell.xib:
<tableViewCell ... customClass="ProfileHeaderTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
- ✅ Class names are clean (not mangled)
- ✅ Module is correctly set to "SwiftWarplyFramework"
- ✅ Module provider is "target" (correct for SPM)
2. Swift Class Configuration
ALSO GOOD: Our @objc attributes are correctly applied:
@objc(MyRewardsBannerOffersScrollTableViewCell)
public class MyRewardsBannerOffersScrollTableViewCell: UITableViewCell {
3. XIB Bundling
WORKING: Our debug output shows XIB files are found and loaded:
✅ [WarplySDK] Found XIB: MyRewardsBannerOffersScrollTableViewCell at .../MyRewardsBannerOffersScrollTableViewCell.nib
❌ The Real Problem
Root Cause Analysis
The issue is NOT with our XIB configuration or @objc attributes. The problem is more fundamental:
The error shows the mangled name: _TtC41SwiftWarplyFramework_SwiftWarplyFramework40MyRewardsBannerOffersScrollTableViewCell
This suggests that somewhere in the runtime, the system is still trying to resolve the class using the mangled Swift name instead of our clean @objc name.
🔍 Key Findings
1. XIB Files Are Correctly Configured
- Class names:
MyRewardsBannerOffersScrollTableViewCell
(clean) - Module:
SwiftWarplyFramework
- Module provider:
target
2. Swift Classes Have Correct @objc Attributes
-
@objc(MyRewardsBannerOffersScrollTableViewCell)
is properly applied
3. The Disconnect
- XIB expects:
MyRewardsBannerOffersScrollTableViewCell
- Runtime is looking for:
_TtC41SwiftWarplyFramework_SwiftWarplyFramework40MyRewardsBannerOffersScrollTableViewCell
🤔 Possible Causes
1. Module Name Mismatch in SPM
The XIB file specifies customModule="SwiftWarplyFramework"
, but in SPM, the actual module name might be different (like SwiftWarplyFramework_SwiftWarplyFramework
).
2. Build System Issue
The @objc attributes might not be taking effect during the SPM build process.
3. Runtime Class Registration
The class might not be properly registered with the Objective-C runtime under the @objc name.
📋 Recommended Next Steps
Option 1: Module Name Investigation
Check what the actual module name is in SPM vs what's in the XIB files.
Option 2: XIB Module Configuration
Try changing the XIB files to use the actual SPM module name or remove the module specification entirely.
Option 3: Alternative @objc Approach
Try using just @objc
without the explicit name, or use @objc
with the full module-qualified name.
Option 4: Bundle vs Module Issue
The problem might be that we're using customModuleProvider="target"
when we should be using something else for SPM.
🎯 Immediate Action Items
- Verify the actual module name being used in SPM
-
Test XIB without module specification (remove
customModule
andcustomModuleProvider
) - Check if other XIB files have the same issue or if it's specific to this one
- Consider using programmatic cell creation as a fallback if XIB issues persist
Conclusion
The XIB files and Swift classes are configured correctly. The issue appears to be a deeper SPM module name resolution problem where the runtime is still using mangled names despite our @objc attributes.