-
Notifications
You must be signed in to change notification settings - Fork 512
Setting Up Kiwi 2.x without CocoaPods
The recommended means of adding Kiwi to a project is to use the CocoaPods-based setup described in Getting Started with Kiwi 2.0. However, if you would prefer to set up Kiwi without using CocoaPods, you can follow the steps described here.
There are two ways; First: Importing Kiwi project into your Xcode workspace, which is basically what CocoaPods will do for you and second is Importing Kiwi as a framework, which is better if you prefer to keep your project/workspace simple.
Below steps assume Kiwi has been downloaded and there is an existing project with at least one unit-test target.
- Add the Kiwi project to the Xcode workspace.
- Add the Kiwi headers directory to User Headers Search Path of the test target.
- Add the libKiwi.a static library to the test target.
- Add
-ObjC
to the Other Linker Flags of the test target.[1]
See Guide: Up and Running with Kiwi for details of setting up a test project and adding the Kiwi library.
- Select Project > Scheme > Kiwi-iOS from Xcode menu bar and then build it (Cmd+b). Building might take a while since it will compile i386 and arm architectures. When it finishes a finder window will show a folder containing Kiwi.framework
- Drag and drop Kiwi.framework to somewhere in your project.
- Add Kiwi.framework to Link Binary with Libraries of your test target.
- Add
-ObjC
the Other Linker Flags of the test target. [1]
For more information about setting up a unit-test target, see Apple's Xcode Unit Testing Guide.
[1]: Old compilers/linkers (prior to Xcode 4.5) might additionally need -all_load
or -force_load libKiwi.a
- Build Kiwi-XCTest using iOS Simulator
- Copy libKiwi-XCTest.a somewhere (ex.: ~/Desktop/Kiwi/simulator)
- Build Kiwi-XCTest using an iOS Device (ex.: iPhone)
- Copy libKiwi-XCTest.a somewhere (ex.: ~/Desktop/Kiwi/device)
- Copy Kiwi-XCTest (which contains the headers) somewhere (ex.: ~/Desktop/Kiwi/simulator)
- Move into where you copied the files from the previous steps (ex:
cd ~/Desktop/Kiwi
) - Create a new directory where to put the universal binary (ex.:
mkdir -p ~/Desktop/Kiwi/universal
) - Link the simulator and device binaries into the universal binary directory (ex.:
lipo simulator/libKiwi-XCTest.a device/libKiwi-XCTest.a -create -output universal/libKiwi.a
) - Copy the headers (either from simulator or device directory) into the universal directory (ex.:
cp -r simulator/Kiwi-XCTest universal/Kiwi
) - Create a framework container (ex.:
mkdir -p Kiwi.framework && mkdir -p Kiwi.framework/Versions/A/Resources
) - Copy the universal binary into the framework (ex.:
cp universal/libKiwi.a Kiwi.framework/Versions/A/Kiwi
) - Copy the headers into the framework (ex.:
cp -r universal/Kiwi Kiwi.framework/Versions/A/Headers
) - Create a Current simlink in the framework Versions directory (ex.:
ln -s A Kiwi.framework/Versions/Current
) - Create simlinks in the framework root for the binary, headers and resources (ex.:
ln -s Versions/Current/Kiwi Kiwi.framework/Kiwi && ln -s Versions/Current/Headers Kiwi.framework/Headers && ln -s Versions/Current/Resources Kiwi.framework/Resources
) - Add the framework to your project (easiest way is to drag-n-drop it in the Frameworks directory in your project and select the test target. I would recommend selecting the copy items into group's folder)
- In your test target add
-all_load
in Other Linker Flags