Releases: silence0201/iOS-Category
Bug Fix
1.6.3 Bug Fix
1.6.2
no message
1.6.1
Update
1.6.0
Update
1.5.2
The Extended Objective-C library extends the dynamism of the Objective-C programming language to support additional patterns present in other programming languages (including those that are not necessarily object-oriented).
libextobjc is meant to be very modular – most of its classes and modules can be used with no more than one or two dependencies.
Features
libextobjc currently includes the following features:
- Safe categories, using EXTSafeCategory, for adding methods to a class without overwriting anything already there (identifying conflicts for you).
- Concrete protocols, using EXTConcreteProtocol, for providing default implementations of the methods in a protocol.
- Simpler and safer key paths, using EXTKeyPathCoding, which automatically checks key paths at compile-time.
- Compile-time checking of selectors to ensure that an object declares a given selector, using EXTSelectorChecking.
- Easier use of weak variables in blocks, using
@weakify
,@unsafeify
, and@strongify
from the EXTScope module. - Scope-based resource cleanup, using
@onExit
in the EXTScope module, for automatically cleaning up manually-allocated memory, file handles, locks, etc., at the end of a scope. - Algebraic data types generated completely at compile-time, defined using EXTADT.
- Synthesized properties for categories, using EXTSynthesize.
- Block-based coroutines, using EXTCoroutine.
- EXTNil, which is like
NSNull
, but behaves much more closely to actualnil
(i.e., doesn't crash when sent unrecognized messages). - Lots of extensions and additional functionality built on top of
<objc/runtime.h>
, including extremely customizable method injection, reflection upon object properties, and various functions to extend class hierarchy checks and method lookups.
The experimental
branch contains additional features that may be interesting, but are not
considered stable or safe for production use. Check out the headers for more
information.
1.5.1
The Extended Objective-C library extends the dynamism of the Objective-C programming language to support additional patterns present in other programming languages (including those that are not necessarily object-oriented).
libextobjc is meant to be very modular – most of its classes and modules can be used with no more than one or two dependencies.
Features
libextobjc currently includes the following features:
- Safe categories, using EXTSafeCategory, for adding methods to a class without overwriting anything already there (identifying conflicts for you).
- Concrete protocols, using EXTConcreteProtocol, for providing default implementations of the methods in a protocol.
- Simpler and safer key paths, using EXTKeyPathCoding, which automatically checks key paths at compile-time.
- Compile-time checking of selectors to ensure that an object declares a given selector, using EXTSelectorChecking.
- Easier use of weak variables in blocks, using
@weakify
,@unsafeify
, and@strongify
from the EXTScope module. - Scope-based resource cleanup, using
@onExit
in the EXTScope module, for automatically cleaning up manually-allocated memory, file handles, locks, etc., at the end of a scope. - Algebraic data types generated completely at compile-time, defined using EXTADT.
- Synthesized properties for categories, using EXTSynthesize.
- Block-based coroutines, using EXTCoroutine.
- EXTNil, which is like
NSNull
, but behaves much more closely to actualnil
(i.e., doesn't crash when sent unrecognized messages). - Lots of extensions and additional functionality built on top of
<objc/runtime.h>
, including extremely customizable method injection, reflection upon object properties, and various functions to extend class hierarchy checks and method lookups.
The experimental
branch contains additional features that may be interesting, but are not
considered stable or safe for production use. Check out the headers for more
information.
1.5
Update
1.4.2
Usage
- simply call one of added method on an NSString object
- Preferred way is using representedColor method which will detect right color format
Example
[@"red" representedColor]; // UIColor selector name without suffix
[@"redColor" representedColor]; // UIColor full selector name
[@"#FFEE55" representedColor]; // RGB Hexadecimal code. Prefix with # to force hexadecimal method
[@"FFEE55" representedColor]; // RGB Hexadecimal code. Will also work, but will be checked through a regex first
[@"#eeEEEe77" representedColor]; // RGB and RGBA Hexadecimal code are case insensitive too
[@"roSyBroWn" representedColor]; // Web color case insensitive
[@"FFEE55" colorFromRGBcode]; // Hexadecimal code
[@"red" colorFromName]; // UIColor selector name, without color suffix
[@"redColor" colorFromName]; // UIColor full selector name
[@"red" colorFromName]; // UIColor selector name, without color suffix
[@"roSyBroWn" colorFromName]; // Web color case insensitive
Custom color example
[NSString registerColor:[@"#eeeeee"] withKey:@"descriptionText"]; /// Register a custom color
[@"descriptionText" representedColor]; // Retrieve a custom color
[@"dEscRiptIONText" representedColor]; // Custom color names are case insensitive
Advantages
- Allows you to load colors from configuration files
- Remove all boilerplate code induced by format checking
- Add web colors
Bonus
If you are using UIColor categories to add some color code to your project, you can load them from configuration file too. Be careful, selector name are case sensitive.
[@"Facebook" representedColor]; // UIColor selector name from FPBrandColors
[@"Github" representedColor]; // UIColor selector name from FPBrandColors
[@"flatEmeraldColor" representedColor]; // UIColor selector name from UIColor-FlatColors
[@"flatPomegranateColor" representedColor]; // UIColor selector name from UIColor-FlatColors
[@"cssBurlywoodColor" representedColor]; // UIColor selector name from UIColor-CSSColors
[@"cssLightgoldenrodyellowColor" representedColor]; // UIColor selector name from UIColor-CSSColors
1.4.1
Usage
- simply call one of added method on an NSString object
- Preferred way is using representedColor method which will detect right color format
Example
[@"red" representedColor]; // UIColor selector name without suffix
[@"redColor" representedColor]; // UIColor full selector name
[@"#FFEE55" representedColor]; // RGB Hexadecimal code. Prefix with # to force hexadecimal method
[@"FFEE55" representedColor]; // RGB Hexadecimal code. Will also work, but will be checked through a regex first
[@"#eeEEEe77" representedColor]; // RGB and RGBA Hexadecimal code are case insensitive too
[@"roSyBroWn" representedColor]; // Web color case insensitive
[@"FFEE55" colorFromRGBcode]; // Hexadecimal code
[@"red" colorFromName]; // UIColor selector name, without color suffix
[@"redColor" colorFromName]; // UIColor full selector name
[@"red" colorFromName]; // UIColor selector name, without color suffix
[@"roSyBroWn" colorFromName]; // Web color case insensitive
Custom color example
[NSString registerColor:[@"#eeeeee"] withKey:@"descriptionText"]; /// Register a custom color
[@"descriptionText" representedColor]; // Retrieve a custom color
[@"dEscRiptIONText" representedColor]; // Custom color names are case insensitive
Advantages
- Allows you to load colors from configuration files
- Remove all boilerplate code induced by format checking
- Add web colors
Bonus
If you are using UIColor categories to add some color code to your project, you can load them from configuration file too. Be careful, selector name are case sensitive.
[@"Facebook" representedColor]; // UIColor selector name from FPBrandColors
[@"Github" representedColor]; // UIColor selector name from FPBrandColors
[@"flatEmeraldColor" representedColor]; // UIColor selector name from UIColor-FlatColors
[@"flatPomegranateColor" representedColor]; // UIColor selector name from UIColor-FlatColors
[@"cssBurlywoodColor" representedColor]; // UIColor selector name from UIColor-CSSColors
[@"cssLightgoldenrodyellowColor" representedColor]; // UIColor selector name from UIColor-CSSColors
1.4
Add file Hash