Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
this is a VERY loose collection of individual classes and/or components for OSX/IOS that I find myself reusing serveral times and so thought it that it might be good to make them available.
Objective-C
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
DDUtils-Common
DDUtils-IOS
DDUtils-OSX
DDUtils.xcodeproj
.gitignore
Icon.png
LICENSE.txt
README.md
StyleSettings.plist

README.md

About

this is a VERY loose collection of individual classes and/or components for OSX/IOS that I find myself reusing serveral times and so thought it that it might be good to make them available.

Most of the classes are arent meant or even guaranteed to be feature complete. Originally, they were developed for a very specific use case. They were/are all used in one or the other published app and then I thought I'd make them available to the general public.

I wrapped all class [without demos] in a ready to use static library (1 for ios, 1 for osx)

Individual Classes

model-related:
  • DDUnits [ios+osx] + demo - A class to quickly convert between formatted strings and numbers for units.
  • NSFileManager+DataProtection [ios] - A category to quickly add data protection to a file
  • NSFileManager+SkipBackupAttributeToItemAtPath [ios] - A category to exclude a file from an iTunes backup. (With apples storage guidelines, this is often important)
  • DDSocialMessenger [ios+osx] - provides easy-to-use methods to post to twitter or facebook or both! It encapsulates all dealings with accounts and social framework
  • BonjourServicesBrowser [ios+osx] - asynchronously finds services using NSNetServiceBrowser
  • DDPowerMonitor [osx] - easy monitor power mode (battery / ac / charging) and system sleep/wake
  • DBPrefsWindowController [osx] - a window controller that is tailored for doing preferences windows. (has a tabbar, crossfades. Meant to be subclassed. Based on class by Dave Batton)
  • DDASLQuery [ios+osx] + demo - wraps the C apis for querying ASL (default log on ios4+ or 10.6+)
  • DDChecksum [ios+osx] + demo - wraps the C api for building checksums (from apple's CommonCrypto library)
  • DDEmbeddedDataReader [ios+osx] + demos - Based on code from BVPlistExtractor by Bavarious, this class allows easy reading of embedded (linked in) data from any executable. (e.g. a CLI Tool's plist included using the linker flag `-sectcreate __TEXT __info_plist TestInfo.plist`)
  • DDMicBlowDetector [ios] + demo - one class that worries about getting microphone input and making 'sure' that the sound is a blowing/hissing sound… not some random music. (the confidence value for this can be set, as well as min/max durations) The basic algorithm is based on a tutorial from Mobile Orchad by Dan Grigsby.
  • DDFilterableArray [ios+osx] + demo - basic Subclasses of NSArray and NSMutableArray AND a category on NSArray to make a Array class that you can easily filter by passing a prediate format string or a predicate inside of the brackets. (This is great for parsers, see xsd2cocoa for a real life usage)
  • NSObject+TransparentKVC [ios+osx] + demo - use @protocols fot typesafe KVC. E.g. for Accessing parsed JSON (nested NSDictionaries) [clean, consisce, effective, self documenting, see the Demo for a better explanation of this concept]
  • DDRecentItemsManager [ios+osx] + demo - simple wrapper that stores a list of items (NSDictionaries). The array is trimmed to a user-definable maximum (on osx it uses NSDocumentController, on ios it is set to 10 by default). The list is persisted as a plist in the ApplicationSupport directory.
  • DDTask [osx] + demo - 'Replacement' for NSTask that can be run multiple times in any operation / any thread. It tries to get a successful result N times and returns the result of stdout or nil.
  • DDRunTask [osx] - 'Easy convenience' function for running a NSTask in a single line. Run a command just like you'd enter it on the console - quick'n'dirty ;)
  • DDXcodeProject [osx] + demo - A class that wraps a XCode project file. It extracts the basic project variables (name, orga, language, _resolved_ root dir) but it doesnt yet look up targets or files. It uses reflection for the parsing.. also nice. Ive first seen it in AQXMLParser :)
  • M42AbstractCoreDataStack [ios+osx] - offers a simple core data wrapper (if one doesnt want to use the really good library MagicalRecord)
  • M42RandomIndexPermutation [ios+osx] + demo - Helper to build indexsets that are random but the indices remain unique and the sets reproducable.
  • NSFileManager+Count [osx] - (Cocoa wrapper for legacy but fast carbon way of counting files in a folder )
  • NSString+advancedSplit [ios+osx] + demo - A 'smarter' version of componentsBySplittingString. It never breaks inside of quotes and respects escaped strings.
  • NSDictionary+PostData [ios+osx] - Provides a method to get POST Data from a dictionary it supports NSStrings and NSData(!) [it creates multipart post]
  • NSObject+DDDump [ios+osx] + demo - provides a dictionary with reflected information about the class (superclass, protocols, ivars, properties, methods). The category also has a 'dump' method to assemble the data into a NSString that you can output.
  • NSString+ValidateEmail [ios+osx] + demo - Check if a NSString object represents a valid email. Uses some regex.
  • SKPaymentQueue+TransactionForProduct [ios+osx] - Category to search in a PaymentQueue for (any / first successful[restored or not]) transaction for a given product identifier.
  • NSWorkspace+runFileAtPath [osx] - category that provides a method to run any file. It can be an Applescript (NSApplescript is used), a shell script or exectuable (NSTask is used), a file wrapper or app (NSWorkspace is used) or a directory (is opened with the finder). Specified arguments are passed to the Apple Scripts, Shell scripts, to apps and to unix executables.
  • NSArray+DDPerformAfterDelay [ios+osx] - Category on NSArray to easily call makeObjectsPerformSelector after a delay
  • NSManagedObjectContext+RefreshObjectRecursive [ios+osx] - Category on the context to allow to refresh an object RECURSIVELY. The normal refreshObject isnt recursive.
  • NSOperation+Duration [ios+osx] + demo - Category that adds a duration property to ANY NSOperation. (The included test app shows this working with AFNetworking!)
  • NSOperation+UserInfo [ios+osx] + demo - Category that adds a userInfo dictionary property to ANY NSOperation. (The included test app shows this working with AFNetworking!)
  • NSObject+MethodSwizzle [ios+osx] + demo - I found myself doing a lot of swizzling recently, so I added this category. I especially like mikeash's neat trick of swizzling a method of ANY class with a C Function you provide!
  • UIFont+RegisterURL [ios] - This category enables you to load a UIFont from ANY url. The url can be local or remote. It can also point to local a folder (or a NSBundle) to load fonts from there :) Last but not least it provides a convenience method fontWithName:size:ifNeededLoadURL:
  • DDOpenAtLoginController [osx] - This class provides a single property. 'appStartsAtLogin' It adds/removes the current app from the login items list. That bool is bindable and and reflects the system preferences.
  • DDLMUService [osx] - A wrapper for the undocumented IOKit LMUService: The 'kernel driver' for the ambient light sensor AND the LED Backlight of Macbooks (only tested under 10.9 on MBP 2011 but should work for any Macbook able to run 10.8+)
  • DDUserNotificationCenterMonitor [osx] - Component that monitors the global MTNLion notification center. (It uses SCEvents to monitor disk changes and FMDB to read the Notification Center's SQLite database.)
  • DDLanguageConverter [ios+osx]Class to convert between apple language codes to iso6392 language codes or iso3166a3 country codes.
    Also includes two categories for NSLocale to ease development.
  • DDXMLValidator [ios + osx] + demo - Component that validates a given XML file (local or remote) against a Schema (which can be XSD, DTD or RNG.) (It uses libxml2 for the validation and is based on code by Todd Ditchendorfer.)
  • DDAppStoreInfo [ios+osx] + demo - Component that shows how to easily fetch information from the appstore via the Apple iTunes Lookup API
  • NSObject+isValidPlist [ios+osx] - Quick category on NSObject to see if it a plist type and if it is an array or dictionary if it only contains plist objects
ui-related:
  • DDImage+Masked [ios+osx] - Category for both UIImage and NSImage that simplifies masking one image with another one. (It hides all the 'annoying ;)' CoreGraphics code)
  • DDAddressPicker [osx] +demo - A Windowcontroller that offers a PeoplePicker allowing to pick persons from the addressbook. Adding some Features commonly needed
  • M42ActionSheet [ios]] - Drop In Replacement for UIActionSheet with support for custom colored buttons. (specifically we wanted a green one!)
  • M42ClickableImagview & Label [ios] - Subclasses that have action & target and react to touches
  • M42LoadingScreenViewController [ios] - Black screen, White 'Loading...', spinner, progressbar :) Looks a bit like the iOS Startup screen
  • M42PieChartView [ios] - A UIView that displays a 2D PieChart (for more graphing options, look into CorePlot)
  • M42PinchableWebView [osx] - Subclass of WebView which handles zooming in response to pinch gestures.
  • M42TabBarController [ios] - A tab bar that has a 'disabled' property and can draw with a 'black translucent' overlay to signal its status.
  • M42WebViewController [ios] - A view controller that manages a webview. It displays loading labels and offers a back button if appropriate
  • M42WebviewTableViewCell [ios + demo] - Interesting cell that displays html content and tells the controller its required size. A Demo using a minimal tabeView is included.
  • NSWindow+localize [osx] - Category on NSWindow that localizes itself and all its subviews. (knows many defacto default selectors so it works with many views out-of-the-box)
  • NSWindow+Fade [osx] - Category on NSWindow that adds fadeIn and fadeOut actions that work like animated order in order out
  • NSView+findSubview [osx] - Category on NSView that provides aa method to find a(or many) subview (by class and or tag) in its subview-tree.
  • UIView+didAddSubview [ios] - Category on UIView that swizzles in a delegate that gets always called after the view's own didAddSubview method. You no longer have to subclass a view because you need didAddSubview! (needs NSObject+MethodSwizzle!)
  • UIView+findSubview [ios] - Category on UIView that provides methods to find a(or many) subview (by class and or tag) in its subview-tree.
  • UIView+Border [ios] - Category on UIView that provides a simple wrapper around CALayer allowing to easily add a border around a view.
  • NSWorkspace+IconBadging [osx] + demo - Category on NSWorkspace that allows setting icon badges on files/folder (like dropbox or torquoise SVN). (wraps carbon's IconServices API for that)
  • NSAttributedString+DDConvenience [ios+osx] - Category on NSAttributedString to create it from printf like varargs (like stringWithFormat:)
    On OSX there's also attributedStringWithImage.
  • UIAlertView+UserInfo [ios] - Category on UIAlertView that adds a userInfo NSDictionary property to the alert that you can set and get (like it works for NSTimer)

UIImage+DDBadge [ios] - Category on UIImage that returns a badged copy of an image. The look of the badge is customizable to a certain degree

UIImage+DefaultImage - Category on UIImage to easily get the Current App's Default image (the correct version for the Current Device)

DDTextField [ios + demo] - Interesting compound class that provides a common interface for single-line UITextFields and multi-line UITextViews. A Demo showing some differently configured textfields is included. (and the class shows how IBDesignable and IBInspectable works)



ALL IS AVAIABLE under MIT

Something went wrong with that request. Please try again.