Macros
Macros
Default
- TRAIT_PROTOCOL()
Macro to declare trait methods inside a protocol with an associated trait.
In the protocol declaration, TRAIT_PROTOCOL must come before the methods implemented in the associated trait. Other methods in the protocol (not implemented by the trait) can be declared as either @required or @optional as usual.
Take note that TRAIT_PROTOCOL methods are all required methods, although not implementing these methods in the class that adopts the protocol, won't cause compiler warnings.
- A()
Shortcut macro to create a NSArray. Same as +[NSArray dictionaryWithObjects:] .
- D()
Shortcut macro to create a NSDictionary. Same as +[NSDictionary dictionaryWithObjectsAndKeys:] .
- DEALLOC( x)
Macro for creating dealloc methods.
- ETAssert( condition)
Basic assertion macro that just reports the tested condition when it fails. It is similar to NSParameterAssert but not limited to checking the arguments.
- ETAssertUnreachable()
Assertion macro to mark code portion that should never be reached. e.g. the default case in a switch statement.
- FOREACH( collection, object, type)
Macro providing a foreach statement on collections, with IMP caching.
Parameters
- type An element type such as 'NSString *' to typecheck the messages sent to the elements in the code block.
- FOREACHE( collection, object, type, enumerator)
Macro providing a foreach statement on collections, with IMP caching.
Parameters
- collection Can be nil , this argument is ignored.
- type An element type such as 'NSString *' to typecheck the messages sent to the elements in the code block.
- enumerator A custom enumerator object to use to iterate over the collection.
- FOREACHI( collection, object)
Macro providing a foreach statement on collections, with IMP caching.
You should rather use FOREACH that provides basic typechecking.
- INDEXSET()
Shortcut macro to create a NSIndexSet.
- INVALIDARG_EXCEPTION_TEST( arg, condition)
Exception macro to check whether the given argument respects a condition.
When the condition evaluates to NO, an NSInvalidArgumentException is raised.
- LOCAL_AUTORELEASE_POOL()
Create a temporary autorelease pool that is destroyed when the scope exits.
- LOCK_FOR_SCOPE( x)
Macro that sends a -lock message to the argument immediately, and then an -unlock message when the variable goes out of scope (including if an exception causes this stack frame to be unwound).
- NILARG_EXCEPTION_TEST( arg)
Exception macro to check the given argument is not nil, otherwise an NSInvalidArgumentException is raised.
- S()
Shortcut macro to create a NSSet. Same as +[NSSet setWithObjects:] .
- SELFINIT()
Deprecated. You should use the designated initializer rule. Simple macro for safely initialising the current class.
- SUPERINIT()
Simple macro for safely initialising the superclass.
- NS_RESTARTABLE_DURING()
Version of NS_DURING which permits restarts to occur if restartable exception is issued. In the event of a restartable exception being raised, control will jump to the start of this block. Care must be taken to avoid infinite loops and memory leaks.
- NS_RESTARTABLE_HANDLER()
End a restartable exception block. Equivalent to NS_HANDLER to be used with NS_RESTARTABLE_DURING.
- SET_HANDLER( exception, handler)
Adds the specified handler for the named exception for the duraction of the current lexical scope.