• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Super simple category for NSObject that adds a tiny state machine.

Shift

Shift is just a tiny category that adds a cute little state machine to NSObject. It's also a little bit of a learning project that turns out to be a little bit useful at times.

Usage:

It's very simple to use, there really isn't a lot to it.

#import "NSObject+Shift.h"

// First we create an object.
NSString *string = @"Hello world";

// Set a state for it.
string.shiftState = @"inactive";

// Setup some callbacks when that state changes.

[string on:@"active" do:^(id self) {
  NSLog(@"I have become active");
}];

[string before:@"active" do:^(id self) {
  NSLog(@"Going to print this before i become active");
}];

[string after:@"inactive" do:^(id self) {
  NSLog(@"Going to print after state has changed");
}];

[string when:@"inactive" transitionsTo:@"active" do:^(id self) {
  NSLog(@"OMG, My state is transitioning to!!");
}];

[string when:@"active" transitionsFrom:@"inactive" do:^(id self) {
  NSLog(@"OMG, My state is transitioning from!");
}];


string.shiftState = @"active";

License

Read LICENSE file for more info.

More Repositories

1

Glimpse

UIView recording library.
Objective-C
556
star
2

Survey

iOS Form building made simple
Objective-C
311
star
3

overlook

The Judge, Jury and Executioner for the file system
Swift
151
star
4

WCStackNavigationController

A different approach to the stack navigation made popular by Facebook, Path, and so many more. Following more closely to the UINavigationController/UITabController schema.
Objective-C
85
star
5

WCGridView

A Very simple drop in Grid View for iOS, modeled after UITableView/UITableViewController
Objective-C
43
star
6

Cargo.objc

Simplified and easy to use key/value storage framework for iOS
Objective-C
28
star
7

Wilde

NSAttributedString building class for the Orwell Framework
Objective-C
28
star
8

Annex

A small collection of categories & classes to make iOS more comfortable.
Objective-C
27
star
9

swift_zenith

Navigation, controllers and views separated, like food should be.
Swift
26
star
10

veneer

A simple library for building attributed strings, for a more civilized age.
Swift
25
star
11

Vendor

Block based In App Purchase (StoreKit) library that uses blocks to make dealing with purchases easier.
Objective-C
23
star
12

Prompt

Framework for building robust command line applications.
Objective-C
23
star
13

WCGalleryView

A nice gallery view for use in iOS apps, with stack affect.
Objective-C
21
star
14

WCXMLParser

Painless, block using, easy request'n XML Parser
Objective-C
8
star
15

react-vite-appwrite

My template for React apps using vite and appwrite
TypeScript
7
star
16

appendix_swift

Swift Extensions
Swift
6
star
17

iotr

Lord Of The RIngs Ipsum generator
Python
6
star
18

Variant

Easy to use multivariate testing library.
Objective-C
5
star
19

dwell

Virtualenv for Rust in sweet, sweet, bash.
Shell
5
star
20

Criteria

Simple class for handling command line arguments
Objective-C
4
star
21

inquire

iOS Form builder
Swift
4
star
22

jsForms

Build forms in pure javascript
JavaScript
4
star
23

boilerplates

Boilerplates for various things.
CSS
3
star
24

centerstage

Command line helper for Sinatra/Datamapper based apps.
Ruby
3
star
25

Madusa

Medusa is a tiny library that implements Map/Reduce on an NSArray (and more to come!).
Objective-C
2
star
26

TextMess

Just my testing, experimenting and learning the world of CoreText
Objective-C
2
star
27

alloy

Build custom Pi images.
Shell
2
star
28

task

Task runner for the command line. [WIP]
Swift
2
star
29

valance

My css framework with grid love.
SCSS
2
star
30

nenv

Virtual environemt for the Nelua programming language.
Shell
2
star
31

oxide

My little Rusty things.
Rust
2
star
32

motive

Task runner, manager, whatever you need.
Rust
2
star
33

tessatalk

Example chat app using Appwrite.io
TypeScript
1
star
34

appchat

TypeScript
1
star
35

turnstile

Elixir API gateway (well the start of one)
Elixir
1
star
36

Witness

Simple little observer
Swift
1
star
37

nadda

1
star