0

I want to add a framework to my project using Cocoapods. But I don't want to change Podfile manually. I want to use a command line to edit the Podfile like this:

some_command ./Podfile --add AFNetworking --target MyTarget

Is it possible?

Jaylon
  • 55
  • 7

1 Answers1

3

Unfortunately, there isn't such command.

The closer you can do is creating a .sh file that opens the Podfile and writes on it. Example:

podwrite.sh

#!/bin/sh

FILE="Path/To/Podfile"

/bin/cat <<EOM >$FILE
source 'https://github.com/CocoaPods/Specs.git'

target 'MyTarget' do
  use_frameworks!
  pod 'AFNetworking'
end

EOM

Call via terminal:

sh podwrite.sh

Output on the podfile:

source 'https://github.com/CocoaPods/Specs.git'

target 'MyTarget' do
  use_frameworks!
  pod 'AFNetworking'
end
alxlives
  • 5,084
  • 4
  • 28
  • 50