pmusolino / Wormholy

iOS network debugging, like a wizard 🧙‍♂️
MIT License
2.35k stars 189 forks source link

Swift Package Manager SPM support? #112

Open mburda-bc opened 2 years ago

mburda-bc commented 2 years ago

When trying to use SPM I end up with this:

xcodebuild: error: Could not resolve package dependencies:
  Source files for target Wormholy should be located under 'Sources/Wormholy', or a custom sources path can be set with the 'path' property in Package.swift

Do you by any chance plan to support SPM?

EvgenyKarkan commented 2 years ago

Tried specifying the master branch - but still no luck.

pmusolino commented 2 years ago

You can find the reason here https://github.com/pmusolino/Wormholy/pull/82#issuecomment-614583033

dingtianran commented 2 years ago

@pmusolino I think maybe you can make a pre-built XCFramework, then we can have a SPM source

murraysagal commented 2 years ago

@pmusolino I think the concerns you have in #82 (comment) might not be valid now. I think SPM has been enhanced to support all that.

akovalov commented 1 year ago

Here is the script to build an xcFramework file from the source. Just put it in the root and run zsh buildXCFramework.sh. The built xcFramework could be added to the project manually or placed in a repo with the SPM support.

buildXCFramework.sh

# buildXCFramework.sh

FW=Wormholy.framework
XFW=Wormholy.xcframework

# builds iOS slice
xcodebuild archive -scheme Wormholy-iOS -configuration Release -destination 'generic/platform=iOS' -archivePath "./archives/$FW-iphoneos.xcarchive" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO
# builds iOS simulator slice
xcodebuild archive -scheme Wormholy-iOS -configuration Release -destination 'generic/platform=iOS Simulator' -archivePath "./archives/$FW-iphonesimulator.xcarchive" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO
# merges both into .xcframework
rm -rf "$XFW"
xcodebuild -create-xcframework -framework "./archives/$FW-iphonesimulator.xcarchive/Products/Library/Frameworks/$FW" \
                               -framework "./archives/$FW-iphoneos.xcarchive/Products/Library/Frameworks/$FW" \
                               -output "$XFW"