SCClassDefinition Class Reference
Inherits from | SCDataDefinition : NSObject |
Declared in | SCClassDefinition.h |
Overview
This class functions as a means to further extend the definition of user-defined classes. Using class definitions, classes like SCObjectCell and SCObjectSection will be able to better generate user interface elements that truly represent the properties of their bound objects. For more information, please refer to SCDataDefinition.
Upon creation, SCClassDefinition will (optionally) automatically generate all the property definitions for the given class. From there, the user will be able to customize the generated property definitions, add new definitions, or remove generated definitions.
Sample use:
// Extend the definition of 'Task' (user defined class)
SCClassDefinition *taskDef = [SCClassDefinition definitionWithClass:[Task class]
propertyNamesString:@"Task Details:(name,description,category,dueDate);Task Status:(completed)"];
SCPropertyDefinition *namePropertyDef = [taskDef propertyDefinitionWithName:@"name"];
namePropertyDef.required = TRUE;
SCPropertyDefinition *descPropertyDef = [taskDef propertyDefinitionWithName:@"description"];
descPropertyDef.type = SCPropertyTypeTextView;
SCPropertyDefinition *categoryPropertyDef = [taskDef propertyDefinitionWithName:@"category"];
categoryPropertyDef.type = SCPropertyTypeSelection;
NSArray *categoryItems = [NSArray arrayWithObjects:@"Home", @"Work", @"Other", nil];
categoryPropertyDef.attributes = [SCSelectionAttributes attributesWithItems:categoryItems
allowMultipleSelection:NO allowNoSelection:NO];
Tasks
Creation and Initialization
-
+ definitionWithClass:autoGeneratePropertyDefinitions:
Allocates and returns an initialized SCClassDefinition given a class and the option to auto generate property definitions for the given class.
-
+ definitionWithClass:propertyNamesString:
Allocates and returns an initialized SCClassDefinition given a class and a string containing the property names.
-
+ definitionWithClass:propertyNames:
Allocates and returns an initialized SCClassDefinition given a class and an array of the property names to generate property definitions from.
-
+ definitionWithClass:propertyNames:propertyTitles:
Allocates and returns an initialized SCClassDefinition given a class, an array of the property names to generate property definitions from, and array of titles for these properties. * * @param _cls A class for which the definition will be extended. * @param propertyNames An array of the names of properties to be generated. All array elements must be of type NSString. * @param propertyTitles An array of titles to the properties in propertyNames. All array elements must be of type NSString.
-
+ definitionWithClass:propertyGroups:
Allocates and returns an initialized SCClassDefinition given a class and an SCPropertyGroupArray.
-
– initWithClass:autoGeneratePropertyDefinitions:
Allocates and returns an initialized SCClassDefinition given a class and the option to auto generate property definitions for the given class.
-
– initWithClass:propertyNamesString:
Returns an initialized SCClassDefinition given a class and a string containing the property names.
-
– initWithClass:propertyNames:
Allocates and returns an initialized SCClassDefinition given a class and an array of the property names to generate property definitions from.
-
– initWithClass:propertyNames:propertyTitles:
Allocates and returns an initialized SCClassDefinition given a class, an array of the property names to generate property definitions from, and array of titles for these properties. * * @param _cls A class for which the definition will be extended. * @param propertyNames An array of the names of properties to be generated. All array elements must be of type NSString. * @param propertyTitles An array of titles to the properties in propertyNames. All array elements must be of type NSString.
-
– initWithClass:propertyGroups:
Returns an initialized SCClassDefinition given a class and an SCPropertyGroupArray.
Configuration
-
cls
The class associated with the definition.
property
Class Methods
definitionWithClass:autoGeneratePropertyDefinitions:
Allocates and returns an initialized SCClassDefinition given a class and the option to auto generate property definitions for the given class.
+ (id)definitionWithClass:(Class)_cls autoGeneratePropertyDefinitions:(BOOL)autoGenerate
Parameters
- _cls
A class for which the definition will be extended.
- autoGenerate
If TRUE, SCClassDefinition will automatically generate all the property definitions for the given class.
Discussion
The method will also generate user friendly property titles from the names of the generated properties. These titles can be modified by the user later as part of the property definition customization.
Declared In
SCClassDefinition.h
definitionWithClass:propertyGroups:
Allocates and returns an initialized SCClassDefinition given a class and an SCPropertyGroupArray.
+ (id)definitionWithClass:(Class)_cls propertyGroups:(SCPropertyGroupArray *)groups
Parameters
- _cls
A class for which the definition will be extended.
- groups
A collection of property groups.
Declared In
SCClassDefinition.h
definitionWithClass:propertyNames:
Allocates and returns an initialized SCClassDefinition given a class and an array of the property names to generate property definitions from.
+ (id)definitionWithClass:(Class)_cls propertyNames:(NSArray *)propertyNames
Parameters
- _cls
A class for which the definition will be extended.
- propertyNames
An array of the names of properties to be generated. All array elements must be of type NSString.
Discussion
The method will also generate user friendly property titles from the names of the given properties. These titles can be modified by the user later as part of the property definition customization.
Declared In
SCClassDefinition.h
definitionWithClass:propertyNames:propertyTitles:
Allocates and returns an initialized SCClassDefinition given a class, an array of the property names to generate property definitions from, and array of titles for these properties. * * @param _cls A class for which the definition will be extended. * @param propertyNames An array of the names of properties to be generated. All array elements must be of type NSString. * @param propertyTitles An array of titles to the properties in propertyNames. All array elements must be of type NSString.
+ (id)definitionWithClass:(Class)_cls propertyNames:(NSArray *)propertyNames propertyTitles:(NSArray *)propertyTitles
Declared In
SCClassDefinition.h
definitionWithClass:propertyNamesString:
Allocates and returns an initialized SCClassDefinition given a class and a string containing the property names.
+ (id)definitionWithClass:(Class)_cls propertyNamesString:(NSString *)propertyNamesString
Parameters
- _cls
A class for which the definition will be extended.
- propertyNamesString
A string with the property names separated by semi-colons. Example string: @“firstName;lastName”. Property groups can also be defined in the string using the following format: @“Personal Details:(firstName, lastName); Address:(street, state, country)”. The group title can also be ommitted to create a group with no title. For example: @“:(firstName, lastName)”.
Property names string syntax options:
@"property1;property2;property3;..." @"group1 header:(property1, property2,...):group1 footer;group2..."
Discussion
The method will also generate user friendly property titles from the names of the given properties. These titles can be modified by the user later as part of the property definition customization.
Declared In
SCClassDefinition.h
Instance Methods
initWithClass:autoGeneratePropertyDefinitions:
Allocates and returns an initialized SCClassDefinition given a class and the option to auto generate property definitions for the given class.
- (id)initWithClass:(Class)_cls autoGeneratePropertyDefinitions:(BOOL)autoGenerate
Parameters
- _cls
A class for which the definition will be extended.
- autoGenerate
If TRUE, ‘SCClassDefinition’ will automatically generate all the property definitions for the given class.
Discussion
The method will also generate user friendly property titles from the names of the generated properties. These titles can be modified by the user later as part of the property definition customization.
Declared In
SCClassDefinition.h
initWithClass:propertyGroups:
Returns an initialized SCClassDefinition given a class and an SCPropertyGroupArray.
- (id)initWithClass:(Class)_cls propertyGroups:(SCPropertyGroupArray *)groups
Parameters
- _cls
A class for which the definition will be extended.
- groups
A collection of property groups.
Declared In
SCClassDefinition.h
initWithClass:propertyNames:
Allocates and returns an initialized SCClassDefinition given a class and an array of the property names to generate property definitions from.
- (id)initWithClass:(Class)_cls propertyNames:(NSArray *)propertyNames
Parameters
- _cls
A class for which the definition will be extended.
- propertyNames
An array of the names of properties to be generated. All array elements must be of type NSString.
Discussion
The method will also generate user friendly property titles from the names of the given properties. These titles can be modified by the user later as part of the property definition customization.
Declared In
SCClassDefinition.h
initWithClass:propertyNames:propertyTitles:
Allocates and returns an initialized SCClassDefinition given a class, an array of the property names to generate property definitions from, and array of titles for these properties. * * @param _cls A class for which the definition will be extended. * @param propertyNames An array of the names of properties to be generated. All array elements must be of type NSString. * @param propertyTitles An array of titles to the properties in propertyNames. All array elements must be of type NSString.
- (id)initWithClass:(Class)_cls propertyNames:(NSArray *)propertyNames propertyTitles:(NSArray *)propertyTitles
Declared In
SCClassDefinition.h
initWithClass:propertyNamesString:
Returns an initialized SCClassDefinition given a class and a string containing the property names.
- (id)initWithClass:(Class)_cls propertyNamesString:(NSString *)propertyNamesString
Parameters
- _cls
A class for which the definition will be extended.
- propertyNamesString
A string with the property names separated by semi-colons. Example string: @“firstName;lastName”. Property groups can also be defined in the string using the following format: @“Personal Details:(firstName, lastName); Address:(street, state, country)”. The group title can also be ommitted to create a group with no title. For example: @“:(firstName, lastName)”.
Property names string syntax options:
@"property1;property2;property3;..." @"group1 header:(property1, property2,...):group1 footer;group2..."
Discussion
The method will also generate user friendly property titles from the names of the given properties. These titles can be modified by the user later as part of the property definition customization.
Declared In
SCClassDefinition.h