Add Swift Package Manager support (Core + UI + WebP)#1
Open
damian-kolasinski wants to merge 5 commits into
Open
Add Swift Package Manager support (Core + UI + WebP)#1damian-kolasinski wants to merge 5 commits into
damian-kolasinski wants to merge 5 commits into
Conversation
- Package.swift (swift-tools-version 5.9, iOS 15) exposing a single DFImageManager library product covering the Core, UI and WebP subspecs - Pod/Source/include/DFImageManager/ contains symlinks to all public headers so consumers keep #import <DFImageManager/...> style imports; a custom module.modulemap declares the umbrella directory (SPM's auto-generated map would otherwise treat DFImageManager.h as the sole umbrella header) - libwebp comes from the maintained SPM wrapper SDWebImage/libwebp-Xcode pinned at exact 1.3.2 (same version as the vendored pod), replacing the libwebp/webp pod dependency; DFWebPImageDecoder.m now imports <webp/decode.h> (also valid under CocoaPods) - DF_SUBSPEC_WEBP_ENABLED=1 is defined target-wide, matching the merged prefix header CocoaPods generates when the WebP subspec is active, so DFImageManager.sharedManager still registers DFWebPImageDecoder and sends the image/webp Accept header AFNetworking, GIF and PhotosKit subspecs are excluded from the SPM target. The podspec is untouched; CocoaPods consumption keeps working. Claude-Session: https://claude.ai/code/session_01LTj6vGgu7NmTs7bjupWAGh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Swift Package Manager support so the library can be consumed via SPM instead of CocoaPods. The package exposes a single
DFImageManagerlibrary product covering the Core, UI and WebP subspecs (the set the KingsChat app uses). AFNetworking, GIF and PhotosKit subspecs are excluded.What changed
Package.swift— swift-tools-version 5.9, platform iOS 15, one target rooted atPod/Source.Pod/Source/include/DFImageManager/— symlinks to all public headers (Core public + UI + WebP), so consumers keep using#import <DFImageManager/...>exactly as with the CocoaPods framework. Symlinks (the same patternlibwebp-Xcodeuses) avoid duplicate-header drift and keep quoted intra-target imports working.Pod/Source/include/module.modulemap— custom module map declaringumbrella "DFImageManager". Without it, SPM auto-picksDFImageManager.has the sole umbrella header (name matches the module) and the rest of the API disappears from the module.libwebp/webppod dependency is replaced with the maintained SPM wrapper SDWebImage/libwebp-Xcode pinned at exact 1.3.2 (same libwebp version as the pod).DFWebPImageDecoder.mnow imports<webp/decode.h>(also resolves under CocoaPods).DF_SUBSPEC_WEBP_ENABLED=1is defined target-wide viacSettings, matching the merged prefix header CocoaPods generates when the WebP subspec is active —DFImageManager.sharedManagerstill registersDFWebPImageDecoderand sends theimage/webpAccept header.The podspec is untouched; CocoaPods consumption of this repo keeps working.
Consuming
There are no tags on this fork — pin by revision:
Product/target name:
DFImageManager.Validation
xcodebuild -scheme DFImageManager -destination "generic/platform=iOS Simulator" build— succeeds (only pre-existingOSSpinLockdeprecation warnings).<DFImageManager/...>header the KingsChat app uses (plus@import DFImageManager;,DFImageRequest,DFWebPImageDecoder,DFImageManager.sharedManager) builds clean for iOS Simulator from a wiped DerivedData.DFWebPImageDecodersymbols and the compile flags includeDF_SUBSPEC_WEBP_ENABLED=1.https://claude.ai/code/session_01LTj6vGgu7NmTs7bjupWAGh