Skip to content

Categories and classes by Eye Street Research to assist in Cocoa Touch development.

License

Notifications You must be signed in to change notification settings

peterdeweese/es_ios_utils

Repository files navigation

Please look to https://github.com/ConventionalC/ConventionalC, where many of these functionalities are being migrated. It provides more modern objective-c, rubyish categories, static library compilation, CocoaPod specs, and cleaner platform specific headers and sharing.

Eye Street Research iOS Utils

Peter DeWeese, Eye Street Research, LLC. http://research.eyestreet.com Purpose and Method

The primary purpose of this library is to DRY out verbose iOS code and reduce unnecessicary ceremony using language features such as categories, @dynamic, blocks, and the occasional macro. Rails and Java standards are borrowed from when reasonable. When methods are borrowed from other languages, they should generally be conformed to Objective-C convention. Derivative values should be made available as read only properties whenever possible for code brevity, as in the example @" asdf ".strip.

Installation

I prefer including the source of small libraries in Cocoa Touch projects as git submodules to give full insight, easier contribution, and less compilation changes. Drag the es_ios_utils/es_ios_utils directory to your project and do not select to copy. When testing, open the es_ios_utils project. Importing the entire project and adding its targets as dependencies may be an alternative.

#import "ESUtils.h" imports all of the utility categories and macros. Include it in your .pch file.

###Framework The default build creates a framework that can be included in another project.

###Statically Linked Library There is no target for this right now, but it can be done. When including the compiled library in your project, open the build properties and add -ObjC to "Other Linker Flags". In Xcode 3.x, use -all_load or -force_load. Without this flag, categories may not link properly.

Features

See ESNSCategories.h and ESUICategories.h for more methods.

###isEmpty and isNotEmpty properties Implemented for NSArray, NSDictionary, NSNull – which is always empty, NSSet, and NSString. nil.isEmpty returns false, so a full check requires !s || s.isEmpty. Preferably, nil.isNotEmpty returns false so no existance check is necessicary.

###macros Very common and generic operations are included as macros for brevity, prefixed with '$'. Examples: $array(object1, object2, nil) $set(object1, object2, nil) $format(@"My Format: %i", 3)

###ESDynamicMethodResolver Use @dynamic to conveniently bind properties files, xml documents, etc. See ESBoundUserDefaults.h for an example.

###UI UIViews frames edition used to require recreation of a CGRect or multiple lines to get a rect from the view, manipulate it, and then set it again. Now you can use a property directly from the UIView, like myView.x += 20.

UITableView convenience methods reduce usage of index paths. Methods that require a row index but no section assume the first section.

###Core Data Blocks are available for error handling and new object configuration.

To Do

  • Add application tests for UI categories and ESBoundUserDefaults.
  • Add application tests for core data.
  • Test framework product.

About

Categories and classes by Eye Street Research to assist in Cocoa Touch development.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •