##US2MapperKit - Installation
####Manual Install
-
Clone the US2MapperKit repository
-
Add the contents of the Source Directory to the project
-
In the Project's Root Folder create a new folder that will contain all the mapping plist files
-
In the application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following content:
SCRIPT_LOCATION=$(find ${PODS_ROOT} -name modelgen-swift.py | head -n 1) python $SCRIPT_LOCATION -v 0.1 -i $PROJECT_DIR/$PROJECT_NAME/Mappings/ -o $PROJECT_DIR/$PROJECT_NAME/Model/
```
- Move the newly created Run Script phase to the second listing right below the "Target Dependencies" task
####CocoaPods
-
Edit the project's podfile
pod 'US2MapperKit', :git => 'https://github.com/ustwo/US2MapperKit.git'
-
Install US2MapperKit by running
pod install
-
In the Project's Root Folder create a new folder that will contain all the mapping plist files
-
Navigate to the application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following contents:
NOTE: The script below differs for installation via Carthage
SCRIPT_LOCATION=$(find ${PODS_ROOT} -name modelgen-swift.py | head -n 1) python $SCRIPT_LOCATION -v 0.1 -i $PROJECT_DIR/$PROJECT_NAME/Mappings/ -o $PROJECT_DIR/$PROJECT_NAME/Model/ ``` 5. Move the newly created Run Script phase to the second listing right below the "Target Dependencies" task
####Carthage
The installation instruction below are a for OSX and iOS, follow the extra steps documented when installing for iOS.
#####Installation
-
Create/Update the Cartfile with with the following
#US2MapperKit
git "https://github.com/ustwo/US2MapperKit.git"
```
2. Run carthage update
. This will fetch dependencies into a [Carthage/Checkouts][] folder, then build each one.
3. In the application targets’ “General” settings tab, in the “Embedded Binaries” section, drag and drop each framework for use from the Carthage/Build folder on disk.
3. In the project's root folder create a new folder that will contain all the mapping plist files
4. Navigate to the application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following contents:
NOTE: The script below differs for installation via Cocoapods
```
SCRIPT_LOCATION=$(find $SRCROOT -name modelgen-swift.py | head -n 1) python $SCRIPT_LOCATION -v 0.1 -i $PROJECT_DIR/$PROJECT_NAME/Mapping/ -o $PROJECT_DIR/$PROJECT_NAME/Model/ ``` 5. Move the newly created Run Script phase to the second listing right below the "Target Dependencies" task
#####iOS Installation
-
Follow the installation instruction above. Once complete, perform the following steps (If you have setup a carthage build task for iOS already skip to Step 5)
-
Navigate to the targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following content:
/usr/local/bin/carthage copy-frameworks
-
Add the paths to the frameworks you want to use under “Input Files” within the carthage build phase as follows e.g.:
$(SRCROOT)/Carthage/Build/iOS/US2MapperKit.framework
####Script Reference
The model-building script generates a model for part of a build task within the project. Below is a reference for the input parameters.
Parameter Description:
-v defines the version (currently 0.1)
-i defines the location where the plist mappings are stored (`$PROJECT_DIR/$PROJECT_NAME/Mappings`)
-o defines the output directory for the model objects (`$PROJECT_DIR/$PROJECT_NAME/Model`)