Exercise 2: Initiate the binding process on an existing CocoaPod project (IOS451)
The primary goal of this lab is to initiate the binding process on an existing CocoaPod project using Objective Sharpie.
If you haven't already, you will need to download Objective Sharpie. Additionally, you will need to complete this exercise on a Mac running macOS 10.10 or newer for compatiblity with Objective Sharpie.
Objective Sharpie has a minimum requirement of macOS 10.10 or newer.
Make sure CocoaPods is installed
Make sure you have followed the steps in the CocoaPods getting started guide to install CocoaPods support on your macOS development machine.
Note: CocoaPods has a dependency on Ruby.
Alternatively, you can use Homebrew to manage both your Ruby and CocoaPods installation.
- Install Homebrew.
- Run the following command to make sure Homebrew is up-to-date.
brew up
- Run the following command to install Ruby using Homebrew.
brew install ruby
- With Ruby installed, run the following command to install CocoaPods.
brew install CocoaPods
Initialize CocoaPods project
To start, we will need to initialize our CocoaPods project with Objective Sharpie.
- Create a folder for you exercise content.
- Open Terminal and navigate to your exercise folder.
- Type the following command to initialize the project through Objective Sharpie.
sharpie pod init ios AFNetworking
Note: the first time you call a CocoaPods command in a new location, which this sharpie
command will do indirectly, CocoaPods will need to do several initialization steps that can take a while.
Process library into an API definition
Next, we need to create our API definition with Objective Sharpie.
Run the following command to create the API definition for the CocoaPod library.
sharpie pod bind
The Objective Sharpie run will complete with the creation of 2 files:
- ApiDefinitions.cs
- StructsAndEnums.cs
Exercise summary
In this exercise you saw how to initiate the binding process on an existing CocoaPod project using Objective Sharpie.