CocoaPods is a dependency management tool for iOS apps. Using it you can easily express the external libraries (like StackMob) your app relies on and install them.
Create a new iOS project in Xcode. Here we've created an app named "MobFind".
$ cd MobFind
$ ls -F
MobFind/ MobFind.xcodeproj/ MobFindTests/
We need to create a Podfile to contain our project's configuration for CocoaPods. From within your project folder:
$ touch Podfile
$ open Podfile
Your Podfile defines your app's dependencies on other libraries. Add StackMob to it.
platform :ios
pod 'StackMobPush'
Now you can use CocoaPods to install your dependencies.
$ pod install
Your now have a workspace containing your app's project and a project build by CocoaPods which will build a static library containing all of the dependencies listed in your Podfile.
$ ls -F
MobFind/ MobFind.xcodeproj/ MobFind.xcworkspace/ MobFindTests/ Podfile Podfile.lock Pods/
Open the new workspace and we can start developing using the StackMob library
$ open MobFind.xcworkspace
Kiwi specs run just like OCUnit tests. In Xcode ⌘U
will run all the tests for the current scheme.
describe(@"a public method or feature", ^{
beforeEach(^{
//set up
[[someClass stubAndReturn:aResult] aMethod];
});
context(@"when some precondition exists", ^{
beforeEach(^{
//set the precondition
});
it(@"should have a specific behavior", ^{
//verify the behavior
[[aThing shouldNot] equal:someOtherThing];
});
pending(@"should eventually have another behavior", ^{
//pending specs will not execute and generate warnings
[[[anObject should] receive] aMethodWith:anArgument];
[anObject doStuff];
});
context(@"and another condition exists", ^{
//...
});
});
});
Unit tests do not make network requests against StackMob. The project includes a seperate target of integration tests to verify communication with the StackMob API.
cp integration-tests/StackMobCredentials.plist.example integration-tests/StackMobCredentials.plist
open integration-tests/StackMobCredentials.plist
- Set the public and private keys for the StackMob account you want the tests to use.
- Run the "integration-tests" scheme.
- Install the SDK in your app using CocoaPods
- Replace /Pods/StackMobPush with a symlink to your development copy of the SDK
- Your app's Pods project will use the current source of your development copy of the SDK on every build.
- Fork the repository on github and clone your fork.
- Create a topic branch:
git checkout -b make_sdk_better
. - Write some tests for your change.
- Make the tests pass.
- Commit your changes.
- (Go to #2.)
- Make sure your topic branch is up to date with any changes other developers have added to master while you were working:
git checkout master && git pull && git checkout - && git merge master
(git rebase master
for local branches if you prefer). - Push your topic branch to your fork:
git push origin make_sdk_better
. - Create a pull request on github asking StackMob to merge your topic branch into StackMob's master branch.