Dejal Open Source
David Sinclair, owner and developer of Dejal, has released the following Cocoa/Objective-C code as open source for Mac OS X and iOS.
You are welcome to download and use this code, subject to the License Agreement. Read on for more information.
The Dejal open source code is released under a standard BSD license.
Before downloading any of this code, please read the Dejal Open Source License page for details of attribution and more.
Get a Non-Attribution License
If you want or need to use the code without giving Dejal credit, non-attribution licenses are available for purchase from the Developer Store.
You can use this code completely free of charge, if you give Dejal credit. But if this code helps you solve a problem or saves you time, David always appreciates a donation to support and encourage future open source development.
Visit the Developer Store to make a donation via PayPal.
Alternatively, a fun option is to send David a gift from his Amazon.com Wish List. It's always nice to receive a surprise package in the mail.
Get In Touch!
If you use this code, David wants to hear from you! In the future we might link to apps that use these projects, which would help your Google juice. David can't promise to help with the code, but will try to answer questions about it or licensing. Contact us.
If you find issues or want to request enhancements, please use the issue tracker for each project (hosted on GitHub). Or better yet, fork the code and implement the feature/fix yourself, then submit a pull request.
Keep Up To Date
Preferably use the GitHub repositories rather than zip archives to make it easier to get any updates.
You can also follow @dejalopen on Twitter to get notifications of updates, and/or subscribe to the RSS feed of the Dejal Blog filtered for Open Source topics.
DejalUIKitCategories is a collection of categories for UIKit on iOS, to add useful methods to classes like
UIView, and others.
- UIApplication+Dejal: Adds methods to get the first responder and keyboard view of the app.
- UIBarButtonItem+Dejal: Convenience initializers to make
UIBarButton instances based on and image, title, system item, custom view, spacer, or segmented control.
- UIButton+Dejal: A more convenient title property, and a method to add a gloss effect.
- UIColor+Dejal: Convenience initializers for more standard colors, or based on a platform-specific image or hex value.
- UIImage+Dejal: Convenience initializers for tinted images, methods to overlay images with colors, and scaling methods.
- UIImageView+Dejal: Make a white-background image view, and adjust the background color based on the highlighted state.
- UILabel+Dejal: Convenience initializers for labels with various text, font, width etc attributes, and sizing methods.
- UISegmentedControl+Dejal: Convenience initializer for a segmented control with specified items, target, action, and initial selection.
- UITextField+Dejal: A selected range property, and support for gestures to move the insertion point by swiping.
- UITextView+Dejal: Attributes of the selection or insertion point, and support for the insertion point swiping gestures.
- UIView+Dejal: Properties for frame and bounds components and an image representation, methods to hide, add to and remove from the superview with animation.
DejalAppKitCategories (OS X)
DejalAppKitCategories is a collection of categories for AppKit on OS X, to add useful methods to classes like
NSTextView, and others.
- NSButton+Dejal: A text color property and a method to display a menu, plus methods to manage radio buttons without the informally-deprecated NSMatrix.
- NSImage+Dejal: Methods to draw flipped images, apply a badge or tint, or get a PNG representation.
- NSMenu+Dejal: Methods to add and remove items.
- NSOutlineView+Dejal: Methods for selected items and displaying a menu.
- NSPopUpButton+Dejal: Methods to add and select items.
- NSScreen+Dejal: Screen name methods.
- NSSplitView+Dejal: Methods for split positions and collapsing and expanding.
- NSTableView+Dejal: Selection, column and copying methods.
- NSTextField+Dejal: Methods to set values, synchronize with a slider, and resize the window (using autoresizing).
- NSTextView+Dejal: Properties for string, attributed string and RTF values, methods for length, range, appending, and selection.
- NSToolbar+Dejal: Methods for the toolbar height and finding an item by identifier.
- NSView+Dejal: Add a view as a fully-constrained subview, adjust autoresizing, scale, and set the alpha opacity.
- NSViewController+Dejal: Transition a view controller to another one as a fully-constrained subview.
- NSWindow+Dejal: Methods to force editing to end, fade in a window, and adjust the sizing of the window based on a view.
DejalAppKitExtensionCategories (OS X)
DejalAppKitExtensionCategories is a collection of categories to extend Foundation classes with methods specific to OS X.
- NSAttributedString+AppKit+Dejal: Adds convenience initializers to load from a bundle resource, image URL or RTF, and to return a RTF.
- NSDictionary+AppKit+Dejal: Extends
NSMutableDictionary to support
- NSFileManager+AppKit+Dejal: Adds a method to determine if a path is a directory but not a package, and to move a file to the Trash.
- NSObject+AppKit+Dejal: Extends the
NSObject base class with an old-style modal did-end perform selector, and modifier key detection.
- NSSString+AppKit+Dejal: Adds methods that depend on fonts, points and colors.
- NSUserDefaults+AppKit+Dejal: Adds support for points, sizes and colors in
DejalFoundationCategories (OS X & iOS)
DejalFoundationCategories is a collection of Foundation-level categories, to add useful methods to classes like
NSString, and others.
- NSArray+Dejal: 30+ methods extending
NSMutableArray, including object matching, reversal, sorting, deep copying, adding and removing.
- NSAttributedString+Dejal: 10+ methods extending
NSMutableAttributedString, including convenience initializers, RTF and font methods.
- NSData+Dejal: A couple of methods to make archiving and unarchiving objects slightly more convenient.
- NSDate+Dejal: 50+ methods extending
NSDate, including convenience initializers, handy date component properties and calculators, JSON date support, string formatting, and relative date output.
- NSDictionary+Dejal: 25+ methods extending
NSMutableDictionary, including object matching, scalar support, deep copying, and more.
- NSFileManager+Dejal: 15+ methods extending
NSFileManager, including convenient file attributes, file renaming, and path building.
- NSObject+Dejal: 15+ methods extending the
NSObject base class, including key-value conveniences, “equivalent” comparisons, and
- NSString+Dejal: 80+ methods extending
NSMutableString, including scalar value formatting, contains evaluation, comparisons, substring and range utilities, reformatting, checksum and encoding utilities, internet utilities, file path methods, and appending and replacing methods.
- NSUserDefaults+Dejal: 15+ methods extending
NSUserDefaults, including support for default values, sanitizing values, time intervals, factory settings, and copying preferences.
DejalUtilities (OS X & iOS)
DejalUtilities is a single header file with some useful
#define macros and static functions.
DejalClassSelectorAvailable() macros, to help determine available APIs.
DejalMonthsFromInterval(), and similar macros, to convert seconds to and from other units.
DEJAL_COMPILE_DATE_TIME macros, to help with debug information.
- Adds a
DejalWeakSelf macro to easily make a weak representation of self for use with blocks.
- Plus several other handy macros and inline functions.
DejalBackgroundView (OS X)
DejalBackgroundView is a
NSView subclass to provide a background color and/or border color to a view.
- Adds a
drawsBackground BOOL property. Defaults to
- Adds a
drawsBorder BOOL property. Defaults to
- Adds a
backgroundColor NSColor property. Defaults to
nil, but lazily assigns a light blue color if not set to another color.
- Adds a
borderColor NSColor property. Defaults to
nil, but lazily assigns a light gray color if not set to another color.
IB_DESIGNABLE support for all four properties, so they can be set in Interface Builder.
DejalActivityView conveniently displays a horizontal, bezel-style, or keyboard-covering view with a spinning activity indicator and adjustable text.
- DejalActivityView: a simple horizontal-style loading view, intended for situations where you have a blank view while loading data.
- DejalWhiteActivityView: the same as the simple one, but with a white indicator and text instead of black, for use in dark views.
- DejalBezelActivityView: an animated round-rect-enclosed variation, with a gray background covering the parent view.
- DejalKeyboardActivityView: displays over the keyboard. Rarely used nowadays (and may be removed in a future version; let me know if you need it).
- A demo project is included.
DejalView is a
UIView subclass to detect a tap outside a button (or other view) like
UITableView's red Delete button.
- Adds a
viewDelegate property to the view.
- If set, a
-view:hitTest:withEvent:hitView: method is invoked on the delegate.
- That delegate method can return the passed view to act normally, or return
nil to ignore the tap.