• Stars
    star
    168
  • Rank 224,618 (Top 5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 8 years ago

Reviews

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

Repository Details

Objective-c block categories and subclasses

##BBNSButton.h

###@interface BBNSButton : NSButton

Set the callback block to be called when the mouse enters the button.

- (void)setInCallback:(BBNSButtonCallback)block;

Set the callback block to be called when the mouse exits the button.

- (void)setOutCallback:(BBNSButtonCallback)block;

Set both the *enter and exit callback blocks.

- (void)setInCallback:(BBNSButtonCallback)inBlock andOutCallback:(BBNSButtonCallback)outBlock;

##BBlock.h

###@interface BBlock : NSObject

For when you need a weak reference of an object, example: BBlockWeakObject(obj) wobj = obj;

For when you need a weak reference to self, example: BBlockWeakSelf wself = self;

Execute the block on the main thread

+ (void)dispatchOnMainThread:(void (^)())block;

Exectute the block on a background thread but in a synchronous queue

+ (void)dispatchOnSynchronousQueue:(void (^)())block;

Exectute the block on a background thread but in a synchronous queue,

This queue should only be used for writing files to disk.

+ (void)dispatchOnSynchronousFileQueue:(void (^)())block;
+ (void)dispatchOnDefaultPriorityConcurrentQueue:(void (^)())block;
+ (void)dispatchOnLowPriorityConcurrentQueue:(void (^)())block;
+ (void)dispatchOnHighPriorityConcurrentQueue:(void (^)())block;

##NSApplication+BBlock.h

###@interface NSApplication (BBlock)

- (void)beginSheet:(NSWindow*)sheet modalForWindow:(NSWindow*)modalWindow completionHandler:(void (^)(NSInteger returnCode))handler;

##NSArray+BBlock.h

###@interface NSArray(BBlock)

Enumerate each object in the array.

- (void)enumerateEachObjectUsingBlock:(void(^)(id obj))block;

Apply the block to each object in the array and return an array of resulting objects

- (NSArray *)arrayWithObjectsMappedWithBlock:(id(^)(id obj))block;

##NSButton+BBlock.h

###@interface NSButton(BBlock)

WARNING: This category is still in early development. Currently the order of calling these methods is important:

  1. setImage
  2. setAlternateBackgroundImage
  3. setBackgroundImage

Tries to mimic UIButton by exposing a method to set the background image. The image set with setImage is composited on-top of the background image.

- (void)setBackgroundImage:(NSImage *)backgroundImage;

Tries to mimic UIButton by exposing a method to set the alternate background image. The image set with setAlternateImage is composited on-top of the alternate background image. If no alternateImage is set image will be used instead.

- (void)setAlternateBackgroundImage:(NSImage *)alternateBackgroundImage;

##NSDictionary+BBlock.h

###@interface NSDictionary(BBlock)

Enumerate each key and object in the dictioanry.

- (void)enumerateEachKeyAndObjectUsingBlock:(void(^)(id key, id obj))block;
- (void)enumerateEachSortedKeyAndObjectUsingBlock:(void(^)(id key, id obj, NSUInteger idx))block;

##NSImage+BBlock.h

###@interface NSImage(BBlock)

Returns a NSImage rendered with the drawing code in the block. This method does not cache the image object.

+ (NSImage *)imageForSize:(NSSize)size withDrawingBlock:(void(^)())drawingBlock;

Returns a cached NSImage rendered with the drawing code in the block. The NSImage is cached in an NSCache with the identifier provided.

+ (NSImage *)imageWithIdentifier:(NSString *)identifier forSize:(NSSize)size andDrawingBlock:(void(^)())drawingBlock;

##NSObject+BBlock.h

###@interface NSObject(BBlock)

- (NSString *)addObserverForKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options block:(NSObjectBBlock)block;
- (void)removeObserverForToken:(NSString *)identifier;

##NSTimer+BBlock.h

###@interface NSTimer(BBlock)

+ (id)timerWithTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;
+ (id)timerRepeats:(BOOL)repeats withTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;
+ (id)scheduledTimerWithTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;
+ (id)scheduledTimerRepeats:(BOOL)repeats withTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;

##NSURL+BBlock.h

###@interface NSURL(BBlock)

Access a security scoped bookmark for sandboxed mac apps.

This method starts the access, runs the block, then stops the access.

-(void)accessSecurityScopedResourceWithBlock:(void (^)())block;

##NSAlert+BBlock.h

###@interface NSAlert(BBlock)

Run NSAlert as sheet for window with completion handler block.

-(void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSInteger returnCode))handler contextInfo:(void *)contextInfo;

##SKProductsRequest+BBlock.h

###@interface SKProductsRequest(BBlock)

Request a StoreKit response for a set of product identifiers

+ (id)requestWithProductIdentifiers:(NSSet *)productIdentifiers andBlock:(SKProductsRequestBBlock)block;
- (id)initWithProductIdentifiers:(NSSet *)productIdentifiers andBlock:(SKProductsRequestBBlock)block;

##UIActionSheet+BBlock.h

###@interface UIActionSheet(BBlock)

- (void)setCompletionBlock:(UIActionSheetBBlock)block;
- (id)initWithTitle:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle destructiveButtonTitle:(NSString *)destructiveTitle otherButtonTitle:(NSString *)otherTitle completionBlock:(UIActionSheetBBlock)block;

##UIAlertView+BBlock.h

###@interface UIAlertView(BBlock)

- (void)setCompletionBlock:(UIAlertViewBBlock)block;
- (id)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelTitle otherButtonTitle:(NSString *)otherButtonTitle completionBlock:(UIAlertViewBBlock)block;

##UIButton+BBlock.h

###@interface UIButton(BBlock)

- (void)addActionForControlEvents:(UIControlEvents)events withBlock:(BBlockUIButtonBlock)block;

##UIGestureRecognizer+BBlock.h

###@interface UISwipeGestureRecognizer(BBlock)

- (id)initWithDirection:(UISwipeGestureRecognizerDirection)direction andBlock:(UIGestureRecognizerBBlock)block;
+ (id)gestureWithDirection:(UISwipeGestureRecognizerDirection)direction andBlock:(UIGestureRecognizerBBlock)block;

###@interface UIGestureRecognizer(BBlock)

- (id)initWithBlock:(UIGestureRecognizerBBlock)block;
+ (id)gestureWithBlock:(UIGestureRecognizerBBlock)block;

##UIImage+BBlock.h

###@interface UIImage(BBlock)

Returns a UIImage rendered with the drawing code in the block. This method does not cache the image object.

+ (UIImage *)imageForSize:(CGSize)size withDrawingBlock:(void(^)())drawingBlock;
+ (UIImage *)imageForSize:(CGSize)size opaque:(BOOL)opaque withDrawingBlock:(void(^)())drawingBlock;

Returns a cached UIImage rendered with the drawing code in the block. The UIImage is cached in an NSCache with the identifier provided.

+ (UIImage *)imageWithIdentifier:(NSString *)identifier forSize:(CGSize)size andDrawingBlock:(void(^)())drawingBlock;
+ (UIImage *)imageWithIdentifier:(NSString *)identifier opaque:(BOOL)opaque forSize:(CGSize)size andDrawingBlock:(void(^)())drawingBlock;

More Repositories

1

KGNoise

Cocoa noise drawing code plus a ready to go noise view!
Objective-C
776
star
2

KGModal

KGModal is an easy drop in control that allows you to display any view in a modal popup.
Objective-C
453
star
3

InAppSettings

InAppSettings provides a view controller that displays the application's Settings.bundle as it appears in the iPhone settings. Allowing the same preferences in app and in the iPhone settings.
Objective-C
233
star
4

Hark

An example Text to Speech App
Swift
186
star
5

KGNAutoLayout

Making AutoLayout Easy
Swift
124
star
6

DBPrefsWindowController

A subclass of NSWindowController that provides an easy way to create preference windows.
Objective-C
116
star
7

KGDiscreetAlertView

An easy drop in control that allows you to display a discrete alert in any view.
Objective-C
101
star
8

KGKeyboardChangeManager

A block-based wrapper around the hairy world of iOS keyboard notifications and frames
Objective-C
93
star
9

Spectttator

Spectttator is an Objective-C framework for OSX and iOS that makes it easy to asynchronously interact with the dribbble api.
Objective-C
86
star
10

UIImage-Vector

UIImage category for dealing with vector formats like PDF and icon fonts.
Objective-C
73
star
11

KGNotePad

KGNotePad is a text view complete with lines and torn paper.
Objective-C
71
star
12

PaintCodeExample

An example iPhone app using PaintCode and BBlock
Objective-C
68
star
13

KGPixelBoundsClip

NSImage and UIImage category that provides methods to find the pixel bounds of an image and create a new image clipped to those bounds.
Objective-C
62
star
14

LinenClipView

Adds a linen pattern behind scrollviews like in Apple's Lion apps.
Objective-C
58
star
15

LaunchAtLoginHelper

A helper app to launch a main app at login under sandboxing
Objective-C
57
star
16

EyeTunes

This is a git-svn fork of the EyeTunes project with support for iTunes 10.
Objective-C
34
star
17

KGNPreferredFontManager

Helper class to registering custom fonts for UIFontTextStyle
Swift
21
star
18

JSONMagic

JSONMagic makes it easy to traverse and parse JSON in Swift.
Swift
19
star
19

UIColorCategories

Category methods UIColor
Objective-C
15
star
20

SCKeyRecorder

An Objective-C shortcut recorder for the Mac.
Objective-C
15
star
21

Coaches-Loupe

Upload shots to dribbble.com
C
14
star
22

KGJSON

A simple category around NSJSONSerialization for common JSON string operations
Objective-C
13
star
23

BBBouncePass

An Objective-C library for uploading shots to Dribbble.
Objective-C
12
star
24

KGNGradientView

KGNGradientView is a collection UIView subclasses for linear and radial gradients.
Swift
10
star
25

pygml

A python library for reading and writing gml files.
Python
9
star
26

KGLib

Cocoa library code
Objective-C
8
star
27

KGNCameraController

A camera view build on top of AVFoundation
Objective-C
7
star
28

Gister

Cocoa app for viewing gists.
Objective-C
7
star
29

KGNColor

A collection of UIColor extensions
Swift
7
star
30

BirdHouseKit

An AFNetworking based Twitter library(unfinished)
Objective-C
6
star
31

UIView-KGNAutoLayout

Auto Layout helper methods for common layout operations.
Objective-C
6
star
32

ShapecatcherKit

An Objective-CFramework for the shapecatcher.com api
Objective-C
5
star
33

ImageViewPlus

A Safari Extension that adds formatting to the image view page.
JavaScript
5
star
34

kgn_icons

Icons
Python
5
star
35

KGNThread

A collection of helpful methods that wrap GCD
Swift
4
star
36

NSData-Base64

Git repo of http://cocoawithlove.com/2009/06/base64-encoding-options-on-mac-and.html
Objective-C
4
star
37

IcnsFactory

Create Mac Icons(.icns) from Cocoa
Objective-C
3
star
38

TimeDisplay

A python package for displaying time deltas and runtimes as nice readable strings.
Python
3
star
39

cssutils

git clone
Python
3
star
40

CocoaVerbalExpression

Objective-C
2
star
41

buildly

Continuous build system for iOS apps
Python
2
star
42

sketchpreset

Useful sketch preset files
2
star
43

QLWebloc

This is a failed attempt to display the content of a webpage in quicklook from a .webloc file.
C
2
star
44

KGNUserInterface

A collection of the core user interface resources.
Swift
2
star
45

XCodeSnippets

CodeSnippets for Xcode + a python script to generate a readme so you can see what's in em
Python
2
star
46

pyglang

A python package for translating text with the 'Google AJAX Language API'
Python
2
star
47

KeeganScriptPack

A collection of mel scripts I wrote a while back.
2
star
48

CodingConventions

Name & Code Conventions for 1kLabs, Inc.
2
star
49

growlcoffee

Growl notifications for CoffeeScript
JavaScript
1
star
50

resume

My Resume
1
star
51

StyleGuide

The style guide for 1kLabs, Inc.
1
star
52

mdoc

GitHub markdown documentation generator for Objective-C
Python
1
star
53

PDFImageConverter

Modified code from a ipdfdev.com post
Objective-C
1
star
54

KGNSketchToolkit

Plugins for Sketch
JavaScript
1
star