xcode-build-script-for-carthage icon indicating copy to clipboard operation
xcode-build-script-for-carthage copied to clipboard

If you're using Carthage, you can easily set up Framework dependency in XCode through this script

XCode Build Script for Carthage

GitHub license

If you're using Carthage as the library dependency manager, you must manually configure the framework path to Build phases and Build settings in XCode after run 'carthage update'. However, using this script after run 'carthage update' eliminates the need to manually configure the framework path.

After carthage update, this script add a run script for Carthage to Build Phases, set up frameworks dependency and add framework search paths to Build Settings

  • Getting Started
  • Example

Getting Started

This script uses Xcodeproj. Install it by performing the following command:

$ [sudo] gem install xcodeproj

1. To use the script, open the ruby file (Source/carthage_build_setup.rb)

Enter the target of your project in @scriptTargets you want to apply the script to.

# Constants
@scriptTargets = []

Enter the path to your project.

# Constants
CARTHAGE_FRAMEWORK_PATH = "YOUR_CARTHAGE_FOLDER_PATH/Carthage/Build/iOS"

# Variables
@project = Xcodeproj::Project.open"YOUR_PROJECT_PATH/YOUR_PROJECT_NAME.xcodeproj"

2. Move the script file to your project path.

3. Run

$ carthage update
$ ruby carthage_build_setup.rb

4. Press check, your project Build Phases, Frameworks and Framework Search Paths in Build Settings

Example

Building Project

  1. Install Carthage libraries.

    $ carthage update
    $ cd Scripts
    $ ruby carthage_build_phase_setup.rb
    

    or

    $ cd Scripts
    $ sh carthage_update.sh
    
  2. Open CarthageScriptExample.xcodeproj file.

  3. Press + B to build the project.

  4. Press check, the build is succeeded

  5. Press check, your project Build Phases and Framework Search Paths in Build Settings

Script Success

script-success

Frameworks Dependency

project-frameworks

Build Phases

build-phases

LICENSE

These works are available under the MIT license. See the LICENSE file for more info.