{"id":17068952,"url":"https://github.com/kgn/bblock","last_synced_at":"2025-05-11T15:43:31.963Z","repository":{"id":56902743,"uuid":"3607058","full_name":"kgn/BBlock","owner":"kgn","description":"Objective-c block categories and subclasses","archived":false,"fork":false,"pushed_at":"2016-01-31T15:31:02.000Z","size":273,"stargazers_count":169,"open_issues_count":2,"forks_count":26,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-03T03:38:49.784Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kgn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-02T23:07:51.000Z","updated_at":"2025-03-27T22:17:09.000Z","dependencies_parsed_at":"2022-08-21T01:50:46.547Z","dependency_job_id":null,"html_url":"https://github.com/kgn/BBlock","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgn%2FBBlock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgn%2FBBlock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgn%2FBBlock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgn%2FBBlock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kgn","download_url":"https://codeload.github.com/kgn/BBlock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253436578,"owners_count":21908360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T11:15:42.220Z","updated_at":"2025-05-10T15:32:24.530Z","avatar_url":"https://github.com/kgn.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"##BBNSButton.h\n\n###@interface BBNSButton : NSButton\n\nSet the callback block to be called when the mouse **enters** the button.\n\n```obj-c\n- (void)setInCallback:(BBNSButtonCallback)block;\n```\n\nSet the callback block to be called when the mouse **exits** the button.\n\n```obj-c\n- (void)setOutCallback:(BBNSButtonCallback)block;\n```\n\nSet both the **enter* and **exit** callback blocks.\n\n```obj-c\n- (void)setInCallback:(BBNSButtonCallback)inBlock andOutCallback:(BBNSButtonCallback)outBlock;\n```\n\n##BBlock.h\n\n###@interface BBlock : NSObject\n\nFor when you need a weak reference of an object, example: `BBlockWeakObject(obj) wobj = obj;`\n\nFor when you need a weak reference to self, example: `BBlockWeakSelf wself = self;`\n\nExecute the block on the main thread\n\n```obj-c\n+ (void)dispatchOnMainThread:(void (^)())block;\n```\n\nExectute the block on a background thread but in a synchronous queue\n\n```obj-c\n+ (void)dispatchOnSynchronousQueue:(void (^)())block;\n```\n\nExectute the block on a background thread but in a synchronous queue,\n\nThis queue should only be used for writing files to disk.\n\n```obj-c\n+ (void)dispatchOnSynchronousFileQueue:(void (^)())block;\n```\n\n```obj-c\n+ (void)dispatchOnDefaultPriorityConcurrentQueue:(void (^)())block;\n```\n\n```obj-c\n+ (void)dispatchOnLowPriorityConcurrentQueue:(void (^)())block;\n```\n\n```obj-c\n+ (void)dispatchOnHighPriorityConcurrentQueue:(void (^)())block;\n```\n\n##NSApplication+BBlock.h\n\n###@interface NSApplication (BBlock)\n\n```obj-c\n- (void)beginSheet:(NSWindow*)sheet modalForWindow:(NSWindow*)modalWindow completionHandler:(void (^)(NSInteger returnCode))handler;\n```\n\n##NSArray+BBlock.h\n\n###@interface NSArray(BBlock)\n\nEnumerate each object in the array.\n\n```obj-c\n- (void)enumerateEachObjectUsingBlock:(void(^)(id obj))block;\n```\n\nApply the block to each object in the array and return an array of resulting objects\n\n```obj-c\n- (NSArray *)arrayWithObjectsMappedWithBlock:(id(^)(id obj))block;\n```\n\n##NSButton+BBlock.h\n\n###@interface NSButton(BBlock)\n\n**WARNING**: This category is still in early development.\nCurrently the order of calling these methods is important:\n\n1. `setImage`\n2. `setAlternateBackgroundImage`\n3. `setBackgroundImage`\n\nTries to mimic `UIButton` by exposing a method to set the background image.\nThe image set with `setImage` is composited on-top of the background image. \n\n```obj-c\n- (void)setBackgroundImage:(NSImage *)backgroundImage;\n```\n\nTries to mimic `UIButton` by exposing a method to set the alternate background image.\nThe image set with `setAlternateImage` is composited on-top of the alternate background image.\nIf no `alternateImage` is set `image` will be used instead. \n\n```obj-c\n- (void)setAlternateBackgroundImage:(NSImage *)alternateBackgroundImage;\n```\n\n##NSDictionary+BBlock.h\n\n###@interface NSDictionary(BBlock)\n\nEnumerate each key and object in the dictioanry.\n\n```obj-c\n- (void)enumerateEachKeyAndObjectUsingBlock:(void(^)(id key, id obj))block;\n```\n\n```obj-c\n- (void)enumerateEachSortedKeyAndObjectUsingBlock:(void(^)(id key, id obj, NSUInteger idx))block;\n```\n\n##NSImage+BBlock.h\n\n###@interface NSImage(BBlock)\n\nReturns a `NSImage` rendered with the drawing code in the block.\nThis method does not cache the image object. \n\n```obj-c\n+ (NSImage *)imageForSize:(NSSize)size withDrawingBlock:(void(^)())drawingBlock;\n```\n\nReturns a cached `NSImage` rendered with the drawing code in the block.\nThe `NSImage` is cached in an `NSCache` with the identifier provided. \n\n```obj-c\n+ (NSImage *)imageWithIdentifier:(NSString *)identifier forSize:(NSSize)size andDrawingBlock:(void(^)())drawingBlock;\n```\n\n##NSObject+BBlock.h\n\n###@interface NSObject(BBlock)\n\n```obj-c\n- (NSString *)addObserverForKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options block:(NSObjectBBlock)block;\n```\n\n```obj-c\n- (void)removeObserverForToken:(NSString *)identifier;\n```\n\n##NSTimer+BBlock.h\n\n###@interface NSTimer(BBlock)\n\n```obj-c\n+ (id)timerWithTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;\n```\n\n```obj-c\n+ (id)timerRepeats:(BOOL)repeats withTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;\n```\n\n```obj-c\n+ (id)scheduledTimerWithTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;\n```\n\n```obj-c\n+ (id)scheduledTimerRepeats:(BOOL)repeats withTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;\n```\n\n##NSURL+BBlock.h\n\n###@interface NSURL(BBlock)\n\nAccess a security scoped bookmark for sandboxed mac apps.\n\nThis method starts the access, runs the block, then stops the access.\n\n```obj-c\n-(void)accessSecurityScopedResourceWithBlock:(void (^)())block;\n```\n\n##NSAlert+BBlock.h\n\n###@interface NSAlert(BBlock)\n\nRun NSAlert as sheet for window with completion handler block.\n\n```obj-c\n-(void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSInteger returnCode))handler contextInfo:(void *)contextInfo;\n```\n\n##SKProductsRequest+BBlock.h\n\n###@interface SKProductsRequest(BBlock)\n\nRequest a StoreKit response for a set of product identifiers\n\n```obj-c\n+ (id)requestWithProductIdentifiers:(NSSet *)productIdentifiers andBlock:(SKProductsRequestBBlock)block;\n```\n\n```obj-c\n- (id)initWithProductIdentifiers:(NSSet *)productIdentifiers andBlock:(SKProductsRequestBBlock)block;\n```\n\n##UIActionSheet+BBlock.h\n\n###@interface UIActionSheet(BBlock)\n\n```obj-c\n- (void)setCompletionBlock:(UIActionSheetBBlock)block;\n```\n\n```obj-c\n- (id)initWithTitle:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle destructiveButtonTitle:(NSString *)destructiveTitle otherButtonTitle:(NSString *)otherTitle completionBlock:(UIActionSheetBBlock)block;\n```\n\n##UIAlertView+BBlock.h\n\n###@interface UIAlertView(BBlock)\n\n```obj-c\n- (void)setCompletionBlock:(UIAlertViewBBlock)block;\n```\n\n```obj-c\n- (id)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelTitle otherButtonTitle:(NSString *)otherButtonTitle completionBlock:(UIAlertViewBBlock)block;\n```\n\n##UIButton+BBlock.h\n\n###@interface UIButton(BBlock)\n\n```obj-c\n- (void)addActionForControlEvents:(UIControlEvents)events withBlock:(BBlockUIButtonBlock)block;\n```\n\n##UIGestureRecognizer+BBlock.h\n\n###@interface UISwipeGestureRecognizer(BBlock)\n\n```obj-c\n- (id)initWithDirection:(UISwipeGestureRecognizerDirection)direction andBlock:(UIGestureRecognizerBBlock)block;\n```\n\n```obj-c\n+ (id)gestureWithDirection:(UISwipeGestureRecognizerDirection)direction andBlock:(UIGestureRecognizerBBlock)block;\n```\n\n###@interface UIGestureRecognizer(BBlock)\n\n```obj-c\n- (id)initWithBlock:(UIGestureRecognizerBBlock)block;\n```\n\n```obj-c\n+ (id)gestureWithBlock:(UIGestureRecognizerBBlock)block;\n```\n\n##UIImage+BBlock.h\n\n###@interface UIImage(BBlock)\n\nReturns a `UIImage` rendered with the drawing code in the block.\nThis method does not cache the image object. \n\n```obj-c\n+ (UIImage *)imageForSize:(CGSize)size withDrawingBlock:(void(^)())drawingBlock;\n```\n\n```obj-c\n+ (UIImage *)imageForSize:(CGSize)size opaque:(BOOL)opaque withDrawingBlock:(void(^)())drawingBlock;\n```\n\nReturns a cached `UIImage` rendered with the drawing code in the block.\nThe `UIImage` is cached in an `NSCache` with the identifier provided. \n\n```obj-c\n+ (UIImage *)imageWithIdentifier:(NSString *)identifier forSize:(CGSize)size andDrawingBlock:(void(^)())drawingBlock;\n```\n\n```obj-c\n+ (UIImage *)imageWithIdentifier:(NSString *)identifier opaque:(BOOL)opaque forSize:(CGSize)size andDrawingBlock:(void(^)())drawingBlock;\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgn%2Fbblock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkgn%2Fbblock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgn%2Fbblock/lists"}