Code Monkey home page Code Monkey logo

ios's Introduction

Bendy Tree iOS Library

Overview

This iOS library contains many small bits of code that simplify common iOS tasks.

For example, the iOS SDK has no simple method of showing an alert with a text input (like a JavaScript prompt). So I have a very simple Prompt class that works like this:

[Prompt title:@"Enter your name" delegate:self selector:@selector(promptComplete:)];

- (void) promptComplete:(NSString*)val
{
    NSLog(@"The user entered: %@", val);
}

Available Features

Right now the code documents itself. Here are a few key features so you'll have an idea of what's inside:

  • Categories on common types like NSString, UIView, NSMutableArray, etc. For example:

    NSString* msg = [@"Hello %@" format:@"Josh"];

    BOOL contains = [@"OU, TU, OSU, MZU" contains:@"OU"];

    [users moveObjectFromIndex:5 toIndex:3];

    UIColor* color = [@"990011" hexStringToColor];

  • Core data wrapper for creating, updating, finding, counting, deleting, etc. This is my favorite module of the whole library:

    NSArray* products = [CD find:[Product class]];

    for(Product* product in products)

    product.Description = @"";

    [CD save];

  • Easy alerts, prompts, and loading screens:

    [Alert show:@"Hello World"];

    [Prompt title:@"Enter your name" delegate:self selector:@selector(promptComplete:)];

    [Loading show];

    [Loading hide];

  • Easily manage app settings

    NSString* username = [[SettingsRepository current] getString:@"username" orDefault:@"Unknown"];

    [[SettingsRepository current] setString:@"BendyTree" forKey:@"username"];

Annoying Dependencies

Some parts of this library have outside dependencies. For example, the string formatting requires a 3rd party Regular Expression library. If you're not using string formatting, then it would be annoying to satisfy that dependency. But no worries - you don't have to.

The BT.h file controls what pieces of this library compiled. So if you wanted to use string formatting, then you'd set BT_STRING_FORMATTING to 1. See the comments at the top of BT.h for details.

Getting Started

  1. Clone this repo into a subfolder of your project
cd my_xcode_project/libs
git clone [email protected]:bendytree/iOS.git bendytree
  1. In Xcode, choose "Add Existing Files..." to add these new files

  2. Copy BT-DEMO.h as BT.h

  3. Remove both lines in BT.h that say "REMOVE THIS LINE" (this activates the page)

  4. Add #import "BT.h" to your ProjectName-Prefix.pch

  5. Choose which modules to include (follow directions in BT.h)

ios's People

Contributors

bendytree avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.