Snippet #61
Language: Objective-C, Author: Vincent Esche, License: Public domainAn NSString ObjC category meant as an enhanced version of [myString capitalizedString]. It allows you to feed it with an array of words to be used with their very own capitalization (to protect wo...
NSObject+PropertyListCopying
Language: Objective-C, Author: Belkadan Software, License: MIT/X11Convenience members for deep-copying property lists. This method will default back to shallow copies for objects other than NSArray and NSDictionary.
Snippet #59
Language: Objective-C, Author: , License: Public domainLeopard sends all NSlog() to syslog - what a pain in the debugger! This is similar to snippet ZNLog but my implementation is invoked with a preprocessor macro and the log line has a time of day sta...
NSString+FourCharCode
Language: Objective-C, Author: Belkadan Software, License: MIT/X11Convenience methods to convert an NSString into a FourCharCode (or derived type like an OSType) and back again. Useful for Launch Services and such.
Snippet #57
Language: Objective-C, Author: Michele Balistreri, License: Public domainThis is a sample trampoline application, aiming to simply installation&update of command line tools by Cocoa application. Take a look at http://briksoftware.com/blog/?p=70 for more informations.
Snippet #56
Language: Objective-C, Author: Michele Balistreri, License: Public domainThis code allows to start a Java Virtual Machine inside an application avoiding crashes which may be caused by having classpath items containing the ":" character in their paths, which is also clas...
BSCrashNotifier
Language: Objective-C, Author: Karsten, License: Public domainBSCrashNotifier is a bundle that allows you to be notified when your app is crashing. use it with: NSBundle* bundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"BSCra...
PWLevelIndicator
Language: Objective-C, Author: Collin Henderson, License: Public domainI noticed that the current star rating level indicator style really sucks. So I took it upon myself to make a custom star rater. You can easily change around the images, and size (you have to do th...
PWPolishedSlider
Language: Objective-C, Author: Collin Henderson, License: Public domainThis is a volume slider that looks like the slider from iTunes. Does not support ticked sliding.
NSFileManager (BSAliasResolving)
Language: Objective-C, Author: Michele Balistreri, License: Public domainA very simple category adding a method to resolve aliases from NSFileManager. The actual implementation is from some example on Apple documentation, slightly adapted. It works reliably for both ali...
Snippet #45
Language: Objective-C, Author: Andy Matuschak, License: Public domainGetUUID(): Quickly generate a UUID using Core Foundation.
ZNLog
Language: Objective-C, Author: Tony Arnold (tony@tonyarnold.com), License: Creative Commons AttributionHow many times have you found yourself coding some “sick cocoa code… gosh” (excuse the Napoleon Dynamite reference there), and thought - “Gee whiz Myself, NSLog sure is sorta limp in the actual inf...
BSJobList
Language: Objective-C, Author: Karsten, License: Public domainBSJobList opens a simple window with a list of checkboxes. these checkboxes represent jobs that can be performed. each job that is checked is executed after ok is pressed. Everything is provided as...
UKSoundFileRecorder
Language: Objective-C, Author: Uli Kursterer, License: MIT/X11This is a Cocoa class that uses CoreAudio to record sound from the system's default sound input and writes it to a file.
NSString (NDCarbonUtilities)
Language: Objective-C, Author: Nathan Day, License: BSD (2-clause)This category to NSString adds method to create strings from FSRef and viceversa. It also adds a method to resolve file aliases
Snippet #40
Language: Objective-C, Author: Michele Balistreri, License: Public domainThese functions are useful if you communicate with a Java application via the JNI. As their name implies they are used to convert NSStrings to Java strings and viceversa.
Snippet #39
Language: Objective-C++, Author: Octomagon (www.baconday.org/apps), License: Public domainAdd/Remove your app from Login Items These are two methods to add and remove your program from the Login Items list in Mac OS X 10.4. I didn't write most of the code. It Originally came from ht...
ESSImageCategory
Language: Objective-C, Author: Matthias Gansrigler, License: Public domainThis will make it possible for you not only to get a TIFFRepresentation, but also JPEGRepresentation, JPEG2000Representation, PNGRepresentation, GIFRepresentation, BMPRepresentation.
ESSTimeTrialClass
Language: Objective-C, Author: Matthias Gansrigler, License: Public domainThis class has one simple purpose: Terminate the application, once a certain date has been reached. You just pass the class a date (the date the trial should end) and a termination message and the...
Snippet #35
Language: Objective-C, Author: Michael Bianco, License: Public domainResizes a NSSplitView in a nice fashion allowing for minimum splitview restraints for the left panel
NDAlias
Language: Objective-C, Author: Nathan Day, License: Public domainNDAlias is a wrapper for Apples Alias Records, there is and optional category that add methods for initialising NDAliases from alias files and writing NDAliases to alias files but this is not it's ...
ComBelkadanUtilsFilePathFormatter
Language: Objective-C, Author: Belkadan Software, License: MIT/X11Formats an absolute file path into its display name. When the user edits the field the entire path is shown. By default, also tries to autocomplete a path entered by the user, and only allows paths...
NSString (ComBelkadanUtilsKVO)
Language: Objective-C, Author: Belkadan Software, License: MIT/X11A category for the rare instances where you need to use KVO with NSString/NSMutableString. This allows you to use the key "string" for KVO or Cocoa bindings. Example usage: binding to an NSArray...
Snippet #31
Language: Objective-C, Author: Zachary Schneirov, License: Public domainObjective-C class method to set the invisibility flag of a file.
Snippet #30
Language: C, Author: Zachary Schneirov, License: Public domainWork around SoundManager buffer-level byte-swapping on Intel hardware. CFSwapInt32 compiles down to a single bswap32 instruction. Call like so: FloatArrayByteSwapOnIntel(mixBuffer, bufferSamples);
Snippet #29
Language: C, Author: Zachary Schneirov, License: Public domainFunction that returns true if all bytes in a buffer are NULL. This is useful for testing whether opaque structures like FSRef are valid, presumably after having been bzero'd.
NSWindow (UKFade)
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11This is a little extension to NSWindow in the form of a category that adds a few methods for fading in/out a window.
UKDebugNames
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A little debugging helper function that assigns each pointer a name. That way, you can NSLog() pointers and will get nice, memorable names instead of 0x00848400.
UKCrashReporter
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A simple function that you can call at application startup to send crash reports for your application to a CGI on your server.
UKDirectoryEnumerator
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A faster, more configurable variant of NSDirectoryEnumerator. Uses the Carbon FSGetCatalogInfoBulk() call under the hood to do its work, and gives you greater control over what additional file info...
UKDockProgressIndicator
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A class that shows a small determinate progress bar overlaid over your application's dock icon. This is intended as a drop-in replacement for the NSProgressIndicator view, as it understands the...
UKPrefsPanel
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A simple delegate class that makes it easy to create a simple Preferences window. Put your different preference panes in a tabless NSTabView, connect that to an instance of UKPrefsPanel, and you au...
UKKQueue
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A wrapper class around the kqueue file change notification mechanism. Simply create a UKKQueue, add a few paths to it and listen to the change notifications via NSWorkspace's notification cente...
UKDocumentationController
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A small handy drop-in class lets you easily add menu items that show the "Readme", "Release Notes" and "FAQ" sections of your application's help book. Simply looks up the appropriate anchors.
UKFontMenuController
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A small class that you hook up to your "Format" menu to append a font menu to your menu bar. It will automatically list all collections (or a specific one) from the font panel and thus provide quic...
UKIdleTimer
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11This is a wrapper around the Carbon EventLoopIdleTimer, intended to be used just like an NSTimer. An Idle Timer doesn't trigger until the user has been idle for a while, doing nothing in the GUI of...
UKSpeechSynthesizer
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A wrapper class around the Carbon SpeechChannel that tries to be compatible with but also expands upon the features of Apple's NSSpeechChannel. Also included is UKSpeechSettingsView, which prov...
NSWindow (UKFlipWindow)
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11An NSWindow category which replicates Dashboard's "flip over a window to see its back side" effect. I'm doing all of this manually (NSAffineTransform seems to only let you rotate and scale stuff), ...
UKToolbarFactory
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A simple delegate class that you can drop into a NIB file to add a simple toolbar to your application. You specify the list of allowed items and the default list of items in a .plist file, hook it ...
UKXattrMetadataStore
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A wrapper around the MacOS X 10.4 xattr APIs for attaching metadata to files. Also offers convenience methods for dealing with UTF8 strings and property-list-objects as the metadata values.
UKLoginItemRegistry
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11A Cocoa wrapper class around Apple's LoginItemsAE sample code. Get Apple's LoginItemsAE code at: http://developer.apple.com/samplecode/LoginItemsAE/index.html
UKFilePathView
Language: Objective-C, Author: Uli Kusterer, License: MIT/X11An NSView that displays a file path. This looks kind of like how Sherlock displays the location of a file. Basically you get each folder's display name with its icon in front of it, and little grey...
Snippet #12
Language: C, Author: Karsten, License: Public domainHow to change window tags, in this example it uses the shadow flag, but it can also be used for expose flags, mouse-event transparency and the sticky flag CGSClearWindowTags will _clear_ the tag...
NSWorkspace (BSDriveRecognition)
Language: Objective-C, Author: Michele Balistreri, License: Public domainThis NSWorkspace category allows you to discern between mounted physical volumes and network volumes. Please note that currently only webdav volumes are recognized as network drives, however this c...
NSOutlineView (BSMultipleRowFetch)
Language: Objective-C, Author: Michele Balistreri, License: Public domainA very simple NSOutlineView category which adds a method to fetch all the rows specified in an NSIndexSet with a single method call.
BSSidebar
Language: Objective-C, Author: Michele Balistreri, License: Public domainThis NSTableView subclass tries to mimic the appearance of the Finder sidebar using gradients to highlight selections. I suggest replacing the png's gradients with some vector art looking towards L...
BSLabeledIconCell
Language: Objective-C, Author: Michele Balistreri, License: Public domainAn NSTextFieldCell subclass which displays both an image and a label. It can be used for example in file listing, inside an NSTableView or NSOutlineView to show both the icon and the name of a file.
Snippet #7
Language: Objective-C, Author: Michele Balistreri, License: Public domainThis code access to the low-level framebuffer and can be used for example to take screenshots. This code can be easily adapted to Intel, where the alpha channel should be the last.
NSWorkspace (BSInvisibility)
Language: Objective-C, Author: Michele Balistreri, License: Public domainThis category to NSWorkspace adds the method “isInvisibleFileAtPath:” which checks wether the file at a given path is invisible or not. On Mac OS X there are many ways of making a file invisible, t...
BSPluginLoader
Language: Objective-C, Author: Karsten, License: Public domainBSPluginLoader is a loadable bundle that allows applications to easily load plugins. The plugins can be installed in any applications support folder or in the application's bundle itself.
BSByteFormatter
Language: Objective-C, Author: Michele Balistreri, License: Public domainThis is a formatter (NSFormatter subclass) which converts NSNumber instances representing mostly sizes in bytes and converts them to a human readable string (2048 => "2 KB"). It supports unit of me...
BSHotKey
Language: Objective-C, Author: Karsten, License: Public domainPlugin that adds global hotkey support to any application that loads it. Usage: compile, copy the resulting bundle into your application's plugin folder and tell the app to load the bundle. Regi...
BSSingleLineFormatter
Language: Objective-C, Author: Michele Balistreri, License: Public domainIs a formatter (subclass of NSFormatter) which removes the newlines encountered in input. This can be used to avoid newlines characters to get in NSTextFields, for example by copy&pasting.
NSCharacterSet (BSNewLineCharacterSet)
Language: Objective-C, Author: Found on cocoa-dev ML, License: Public domainThis is a simple category of NSCharacterSet which adds a commodity method to create a set composed only of the newline character.
