Skip to content

Instantly share code, notes, and snippets.

@oleander
Created April 6, 2017 12:26
Show Gist options
  • Star 39 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save oleander/b5d9308453041b1024fc3917e2a2f17a to your computer and use it in GitHub Desktop.
Save oleander/b5d9308453041b1024fc3917e2a2f17a to your computer and use it in GitHub Desktop.
How to use the Swift Package Manager and CocoaPods within the same XCode application
$ npm install -g xcpretty
$ gem install cocoapods
APP="MyApp"
CONSTRUCT=xcodebuild -workspace $(APP).xcworkspace -scheme $(APP) clean
install_deps:
pod install
create_config:
swift package fetch
swift package generate-xcodeproj
wipe:
rm -rf .build $(APP).xcodeproj $(APP).xcworkspace Package.pins Pods Podfile.lock
test: wipe create_config install_deps
$(CONSTRUCT) test | xcpretty
build: wipe create_config install_deps
$(CONSTRUCT) build | xcpretty
// swift-tools-version:3.1
import PackageDescription
let package = Package(
name: "MyApp",
targets: [
Target(
name: "MyApp",
dependencies: []),
Target(
name: "MyAppTests",
dependencies: ["MyApp"]),
],
dependencies: [
.Package(url: "https://github.com/oleander/MyApp.git", majorVersion: 3)
]
)
target 'MyApp' do
use_frameworks!
pod 'A Pod'
target 'MyAppTests' do
inherit! :search_paths
pod "Nimble"
pod 'Quick'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.1'
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment