Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Cocoa Touch Static Library: CoreData
Objective-C
Branch: master

This branch is 8 commits ahead, 84 commits behind acani:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
CocoaPlant.xcodeproj
CocoaPlant
CocoaPlantApp
CocoaPlantSpecs
.gitignore
.gitmodules
README.md
TODO.taskpaper

README.md

CocoaPlant

Merriam-Webster defines plant as:

1 a : a young tree, vine, shrub, or herb planted or suitable for planting

and the verb as:

1 a : to put or set in the ground for growth

Aim

In that vein, the aim of CocoaPlant is to grow the Cocoa frameworks & libraries by adding useful classes, categories, and methods to make Cocoa even better.

Summary

Currently, CocoaPlant is a Cocoa Touch Static Library for use with iOS apps.

CocoaPlant consists of three parts:

  1. Plantation (Foundation)
  2. UIPlant (UIKit)
  3. PlantData (CoreData)

Plantation

NSString leading & trailing trimming methods.

[[[NSFileManager alloc] init] URLForApplicationDirectory:NSDocumentDirectory]

UIPlant

UIAlertView: showWithTitle:, showWithError:

PlantData

Set up the Core Data stack with one method call:

[NSManagedObjectContext contextWithStoreType:NSSQLiteStoreType error:&error]

Customize fetch requests with blocks:

NSArray *results = [User fetchInContext:context error:&error
                                options:^(NSFetchRequest *request) {
                                    [request setFetchLimit:1];
                                    [request setPredicate:predicate];
                                    [request setSortDescriptors:sortDescriptors];
                                    // ...
                                }];

Project Setup

Add CocoaPlant as a Git submodule

This will help you pull in updates and make contributions.

cd ~/Projects/Acani/ # sample project root directory

# Let's make a new directory called Libraries for third-party code.
git submodule add https://github.com/acani/CocoaPlant.git Libraries/CocoaPlant
git submodule update --init
git commit -am 'Add CocoaPlant as a submodule & update --init.'

Add CocoaPlant to Your Xcode Project

In Xcode, select your project at the top of the Project Navigator (⌘1), and press Option-Command-N to create a new group. Name it, e.g., "Libraries." Then, with the Libraries group selected, press Option-Command-A to add files to your project, select CocoaPlant.xcodeproj in Libraries/CocoaPlant/CocoaPlant, and confirm that "Copy items into destination group's folder (if needed)" is unchecked, "Create groups for any added folders" is selected, and all targets are unchecked. Then, click Add.

In Terminal, review and commit your changes:

git diff -w -M --color-words HEAD
git commit -am 'Add Libraries/CocoaPlant group & CocoaPlant project.'

Edit Your Application Target's Settings

In Xcode, select your main Xcode project at the top of the Project Navigator (⌘1), and then, select the target to which you want to add CocoaPlant.

Edit Build Phases

Select the "Build Phases" tab.

  • Under the "Target Dependencies" group, click the plus button, select CocoaPlant from the menu, and click Add.
  • Under the "Link Binary With Libraries" group, click the plus button, select libCocoaPlant.a from the menu, and click Add.

Edit Build Settings

Select the "Build Settings" tab. Make sure "All" is selected in the top left of the bar under the tabs.

In Terminal, review and commit your changes:

git diff -w -M --color-words HEAD
git commit -am 'Edit target info, phases & settings for CocoaPlant.'

Using CocoaPlant in Your App

  • Include CocoaPlant in your app's prefix header file, e.g., AppName-Prefix.pch:

    #import <CocoaPlant/CocoaPlant.h>
    

Updating the CocoaPlant iOS SDK

Pull in remote updates by running these commands from your project root directory:

git submodule foreach 'git pull --rebase'
git commit -am 'Update submodules to latest commit.'

You can add an alias (to ~/.gitconfig) for the first of the two commands above:

git config --global alias.sup "submodule foreach 'git pull --rebase'"

Then, to pull in remote updates, you can just do:

git sup

Contributing to the CocoaPlant iOS SDK

  • Commit your changes.

    cd ~/Projects/Acani/Libraries/CocoaPlant
    git add -A
    git commit
    
  • Fork this repo on GitHub, add your fork as a remote, and push.

    git remote add myuser git@github.com:myuser/venmo-ios-sdk.git
    git push myuser master
    
  • Send CocoaPlant a pull request on GitHub.

Related

Something went wrong with that request. Please try again.