BuiltGroup Class Reference

Inherits from NSObject
Declared in BuiltGroup.h

Static Instance

+ groupWithFieldName:

This should be used to represent a ‘group field’ in your class.

+ (instancetype)groupWithFieldName:(NSString *)fieldName

Parameters

fieldName

UID of the group field in your class schema

Return Value

new BuiltGroup instance

Discussion

 //ObjC
 BuiltGroup *detailGroup = [BuiltGroup groupWithFieldName:@"details"];

 //Swift
 var detailGroup:BuiltGroup = BuiltGroup(fieldName:"details")

Declared In

BuiltGroup.h

+ group

This should be used to represent a ‘group field’ in your class.

+ (instancetype)group

Return Value

new BuiltGroup instance without field name associated.

Discussion

 //ObjC
 BuiltGroup *step = [BuiltGroup group];

 //Swift
 var step:BuiltGroup = BuiltGroup()

Declared In

BuiltGroup.h

Properties

– objectForKey:

Gets the data for given property.

- (BUILT_NULLABLE id)objectForKey:(NSString *)key

Parameters

key

The object’s property

Return Value

The value for the key provided

Discussion

 //Assuming 'detailGroup' is a BuiltGroup instance

 //Obj-C
 id object = [detailGroup objectForKey:@"key"];

 //Swift
 var object = detailGroup.objectForKey("key")

Declared In

BuiltGroup.h

– setObject:forKey:

Sets a value for a key defined.

- (void)setObject:(id)object forKey:(NSString *)key

Parameters

object

object to set

key

key to assign on.

Discussion

 //Assuming 'detailGroup' is a BuiltGroup instance

 //Obj-C
 [detailGroup setObject:@"value" forKey:@"key"];

 //Swift
 detailGroup.setObject("value", forKey:"key")

Declared In

BuiltGroup.h

Add/Remove Group

– addGroup:

Add Group to this object

- (void)addGroup:(BuiltGroup *)group

Parameters

group

Instance of BuiltGroup for this object

Discussion

 //Assuming 'detailGroup' and 'innerGroup' is a BuiltGroup instance and 'innerGroup' is a group inside detail group.

 //ObjC
 [detailGroup addGroup:innerGroup];

 //Swift
 detailGroup.addGroup(innerGroup)

Declared In

BuiltGroup.h

– removeGroup:

Removes Group to this object if present.

- (void)removeGroup:(BuiltGroup *)group

Parameters

group

Instance of BuiltGroup to remove from this object

Discussion

 //Assuming 'detailGroup' and 'innerGroup' is a BuiltGroup instance

 //ObjC
 [detailGroup removeGroup:innerGroup];

 //Swift
 detailGroup.removeGroup(innerGroup)

Declared In

BuiltGroup.h

Add/Remove GroupMultiple

– addGroupMultiple:

Add GroupMultiple to this object

- (void)addGroupMultiple:(BuiltGroupMultiple *)group

Parameters

group

Instance of BuiltGroupMultiple for this object

Discussion

 //Assuming 'detailGroup' is a BuiltGroup instance
 //Assuming 'stepsGroup' is a BuiltGroupMultiple instance

 //ObjC
 [detailGroup addGroupMultiple:stepsGroup];

 //Swift
 detailGroup.addGroupMultiple(stepsGroup)

Warning: This method has been deprecated.

Declared In

BuiltGroup.h

– removeGroupMultiple:

Removes GroupMultiple to this object

- (void)removeGroupMultiple:(BuiltGroupMultiple *)group

Parameters

group

Instance of BuiltGroupMultiple for this object

Discussion

 //Assuming 'detailGroup' is a BuiltGroup instance
 //Assuming 'stepsGroup' is a BuiltGroupMultiple instance

 //ObjC
 [detailGroup removeGroupMultiple:stepsGroup];

 //Swift
 detailGroup.removeGroupMultiple(stepsGroup)

Warning: This method has been deprecated.

Declared In

BuiltGroup.h

Reference

– setReference:forKey:

Assigns a set references to a reference field of an object.

- (void)setReference:(id)reference forKey:(NSString *)key

Parameters

reference

This can either be a UID of a referenced object or array of UIDs of a referenced objects.

key

The uid of the reference field

Discussion

//Obj-C BuiltGroup *detailGroup = [BuiltGroup groupWithFieldName:@“details”]; // setting the project reference [detailGroup setReference:@“bltb6202sample73a1” forKey:@“project”];

//Swift var detailGroup:BuiltGroup = BuiltGroup(fieldName:“details”) // setting the project reference detailGroup.setReference(“bltb6202sample73a1”, forKey:“project”)

Declared In

BuiltGroup.h

– setReferenceWhere:forKey:

Fires a query on Built.io Backend and all the objects which pass the query condition are being assigned to the reference field.

- (void)setReferenceWhere:(NSDictionary *)dictionary forKey:(NSString *)key

Parameters

dictionary

Object specifying the conditions

key

The uid of the reference field

Discussion

//Obj-C BuiltGroup *detailGroup = [BuiltGroup groupWithFieldName:@“details”]; // setting the project reference [detailGroup setReferenceWhere:@{@“name”:@“Super Project #41!”} forKey:@“project”];

//Swift var detailGroup:BuiltGroup = BuiltGroup(fieldName:“details”) // setting the project reference detailGroup.setReferenceWhere([“name”:“Super Project #41!”], forKey:“project”)

Declared In

BuiltGroup.h

– setReferenceWithObject:forKey:

Assigns a set references to a reference field of an object.

- (void)setReferenceWithObject:(id)referenceObject forKey:(NSString *)key

Parameters

referenceObject

This can either an instance of BuiltObject or array of BuiltObject instance.

key

The uid of the reference field

Discussion

//Obj-C BuiltApplication builtApplication = [Built applicationWithAPIKey:@“blt5d4sample2633b”]; BuiltClass projectClass = [builtApplication classWithUID:@“project”]; BuiltObject *projectObject = [projectClass object]; projectObject[@“name”] = @“Super Project #41!”;

BuiltGroup *detailGroup = [BuiltGroup groupWithFieldName:@“details”]; // setting the project reference [detailGroup setReferenceWithObject:projectObject forKey:@“project”];

//Swift var builtApplication:BuiltApplication = Built.applicationWithAPIKey(“blt5d4sample2633b”) var projectClass:BuiltClass = builtApplication.classWithUID(“project”) var projectObject:BuiltObject = projectClass.object() projectObject[“name”] = “Super Project #41!”

var detailGroup:BuiltGroup = BuiltGroup(fieldName:“details”) // setting the project reference detailGroup.setReferenceWithObject(projectObject, forKey:“project”)

Declared In

BuiltGroup.h

– addUpsertForReference:condition:replaceWith:

Use this method only when the values of the fields inside referenced object is to be changed while creating a new object.

- (void)addUpsertForReference:(NSString *)referenceField condition:(NSDictionary *)conditionDictionary replaceWith:(NSDictionary *)replaceDictionary

Parameters

referenceField

Reference field uid on which UPSERT has to be performed

conditionDictionary

A check will be performed, whether any object has the key value pair(s) supplied in the dictionary in the reference field

replaceDictionary

New key value pairs for the fields inside the referenced object

Discussion

 //ObjC
 BuiltGroup *detailGroup = [BuiltGroup groupWithFieldName:@"details"];

 [detailGroup addUpsertForReference:@"project" condition:@{@"name":@"Super Project #41"} replaceWith:@{@"name":@"Super Project A", @"description":@"New project"}];

 //Swift
 var detailGroup:BuiltGroup = BuiltGroup(fieldName:"details")

 detailGroup.addUpsertForReference("project", condition:["name":"Super Project #41"], replaceWith:["name":"Super Project A", "description":"New project"])

Declared In

BuiltGroup.h

– addUpsertForReferences:condition:replaceWith:

Use this method only when the values of the fields inside referenced objects are to be changed while creating a new object.

- (void)addUpsertForReferences:(NSString *)referenceField condition:(NSDictionary *)conditionDictionary replaceWith:(NSDictionary *)replaceDictionary

Parameters

referenceField

Reference field uid (Which is marked as multiple) on which UPSERT has to be performed

conditionDictionary

A check will be performed, whether any object has the key value pair(s) supplied in the dictionary in the reference field

replaceDictionary

New key value pairs for the fields inside the referenced object

Discussion

 //ObjC
 BuiltGroup *detailGroup = [BuiltGroup groupWithFieldName:@"details"];

 [detailGroup addUpsertForReferences:@"project" condition:@{@"name":@"Super Project #41"} replaceWith:@{@"name":@"Super Project A", @"description":@"New project"}];

 //Swift
 var detailGroup:BuiltGroup = BuiltGroup(fieldName:"details")

 detailGroup.addUpsertForReferences("project", condition:["name":"Super Project #41"], replaceWith:["name":"Super Project A", "description":"New project"])

Declared In

BuiltGroup.h

Push/Pull/Update on 'Multiple' Field Type

– pushValue:forKey:

Appends a value in the given field.(Applies only to fields that allow multiple values)

- (void)pushValue:(id)value forKey:(NSString *)key

Parameters

value

Value to be pushed

key

Uid of field

Discussion

 //Obj-C
 [detailGroup pushValue:"will come at front" forKey:@"steps"];

 //Swift
 detailGroup.pushValue("will come at front", forKey:"steps")

Declared In

BuiltGroup.h

– pullValue:forKey:

For the given field, it deletes the first matched value.(Applies only to fields that allow multiple values)

- (void)pullValue:(id)value forKey:(NSString *)key

Parameters

value

Values to be deleted

key

Uid of field

Discussion

 //Obj-C
 [detailGroup pullValue:@"will come at front" forKey:@"steps"];

 //Swift
 detailGroup.pullValue("will come at front", forKey:"steps")

Declared In

BuiltGroup.h

– updateValue:atIndex:forKey:

A value in a field that allows multiple values

//considering 'name' is a multi field under a group
- (void)updateValue:(id)updatedValue atIndex:(NSInteger)index forKey:(NSString *)key

Parameters

updatedValue

New value to be updated

index

Index at which the value is to be updated

key

Uid of field

Discussion

 //Obj-C
 [detailGroup updateValue:@"Go to top right corner" atIndex:0 forKey:@"name"];

 //Swift
 detailGroup.updateValue("Go to top right corner", atIndex: 0, forKey:"name")

Declared In

BuiltGroup.h

Wrap to Group/GroupMultiple

– groupForKey:

Get the info of the specified key of BuiltGroup object and returns instance of BuiltGroup.

- (BuiltGroup *)groupForKey:(NSString *)key

Parameters

key

Key containing the value of BuiltGroup

Return Value

Instance of BuiltGroup

Discussion

 // consider 'about' is a group in details group

 //Obj-C
 BuiltGroup *aboutGroup = [detailsGroup groupForKey:@"about"];

 //Swift
 var aboutGroup:BuiltGroup =  detailsGroup.groupForKey("about")

Declared In

BuiltGroup.h

– groupMultipleForKey:

Get the info of the specified key of BuiltGroupMultiple object and returns instance of BuiltGroupMultiple.

- (BuiltGroupMultiple *)groupMultipleForKey:(NSString *)key

Parameters

key

Key containing the value of BuiltGroupMultiple

Return Value

Instance of BuiltGroupMultiple

Discussion

 // consider 'steps' is a group multiple in details

 //Obj-C
 BuiltGroupMultiple *stepsGroup = [detailsGroup groupMultipleForKey:@"steps"];

 //Swift
 var stepsGroup:BuiltGroupMultiple =  detailsGroup.groupMultipleForKey("steps")

Warning: This method has been deprecated.

Declared In

BuiltGroup.h

Configure

– configureWithDictionary:

Configure properties with builtgroup info.

- (void)configureWithDictionary:(NSDictionary *)dictionary

Parameters

dictionary

User Info

Discussion

 //Obj-C
 [groupObject configureWithDictionary:@{@"Key_name":@"MyValue"}];

 //Swift
 groupObject.configureWithDictionary(["Key_name":"MyValue"])

Declared In

BuiltGroup.h