Ripe
@interface Ripe : Observable <RipeAPI, BrandAPI, BuildAPI, SizeAPI>
Represents a customizable model.
-
The brand of the model-
Declaration
Objective-C
@property (assign, readwrite, atomic) NSString *_Nonnull brand;
Swift
var brand: String { get set }
-
The name of the model.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSString *_Nonnull model;
Swift
var model: String { get set }
-
A map with options to customise the Ripe instance.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSDictionary *_Nonnull options;
Swift
var options: [AnyHashable : Any] { get set }
-
A list of Interactable instances that represent this Ripe instance.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSMutableArray *_Nonnull children;
Swift
var children: NSMutableArray { get set }
-
A list with all the customization changes.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSMutableArray *_Nonnull history;
Swift
var history: NSMutableArray { get set }
-
An index indicating the current point in the customization history. Used for undo and redo operations.
Declaration
Objective-C
@property (assign, readwrite, atomic) int historyPointer;
Swift
var historyPointer: Int32 { get set }
-
The current initials of the model.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSString *_Nonnull initials;
Swift
var initials: String { get set }
-
The current engraving of the model.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSString *_Nonnull engraving;
Swift
var engraving: String { get set }
-
The variant of the model.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSString *_Nonnull variant;
Swift
var variant: String { get set }
-
The current customization of the model.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSMutableDictionary *_Nonnull parts;
Swift
var parts: NSMutableDictionary { get set }
-
The configuration information of the current model.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSDictionary *_Nonnull loadedConfig;
Swift
var loadedConfig: [AnyHashable : Any] { get set }
-
The country where the model will be delivered.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSString *_Nonnull country;
Swift
var country: String { get set }
-
The currency to use when calculating the price.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSString *_Nonnull currency;
Swift
var currency: String { get set }
-
The default locale to use when localizing values.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSString *_Nonnull locale;
Swift
var locale: String { get set }
-
A specific attribute of the model.
Declaration
Objective-C
@property (assign, readwrite, atomic) NSString *_Nonnull flag;
Swift
var flag: String { get set }
-
If the instance is ready for interactions.
Declaration
Objective-C
@property (assign, readwrite, atomic) BOOL ready;
Swift
var ready: Bool { get set }
-
If the default parts of the model should be used when no initials parts are set.
Declaration
Objective-C
@property (assign, readwrite, atomic) BOOL useDefaults;
Swift
var useDefaults: Bool { get set }
-
If the price should be automatically retrieved whenever there is a customization change.
Declaration
Objective-C
@property (assign, readwrite, atomic) BOOL usePrice;
Swift
var usePrice: Bool { get set }
-
Constructs a Ripe instance without an initial brand and model.
The options map supports the following keys:
variant - The variant of the model.
parts - The initial parts of the model.
country - The country where the model will be sold.
currency - The currency that should be used to calculate the price.
locale - The locale to be used by default when localizing values.
flag - A specific attribute of the model.
useDefaults - If the default parts of the model should be used when no initials parts are set.
usePrice - If the price should be automatically retrieved whenever there is a customization change.
plugins - A list of plugins to be registered to the Ripe instance.
Declaration
Objective-C
- (nonnull id)initWithOptions:(nonnull NSDictionary *)options;
Swift
init(options: [AnyHashable : Any] = [:])
Parameters
options
A map with options to configure the Ripe instance.
Return Value
The Ripe instance created.
-
Constructs a Ripe instance with the provided brand and model.
Declaration
Objective-C
- (nonnull id)initWithBrand:(nonnull NSString *)brand model:(nonnull NSString *)model;
Swift
init(brand: String, model: String)
Parameters
brand
The brand of the model.
model
The name of the model.
Return Value
The Ripe instance created.
-
Constructs a Ripe instance without an initial brand and model.
The options map supports the following keys:
variant - The variant of the model.
parts - The initial parts of the model.
country - The country where the model will be sold.
currency - The currency that should be used to calculate the price.
locale - The locale to be used by default when localizing values.
flag - A specific attribute of the model.
useDefaults - If the default parts of the model should be used when no initials parts are set.
usePrice - If the price should be automatically retrieved whenever there is a customization change.
plugins - A list of plugins to be registered to the Ripe instance.
Declaration
Objective-C
- (nonnull id)initWithBrand:(nonnull NSString *)brand model:(nonnull NSString *)model options:(nonnull NSDictionary *)options;
Swift
init(brand: String, model: String, options: [AnyHashable : Any] = [:])
Parameters
brand
The brand of the model.
model
The name of the model.
options
A map with options to configure the Ripe instance.
Return Value
The Ripe instance created.
-
Sets the model to be customised.
Declaration
Objective-C
- (nonnull Promise *)config:(nonnull NSString *)brand model:(nonnull NSString *)model;
Swift
func config(_ brand: String, model: String) -> Promise
Parameters
brand
The brand of the model.
model
The name of the model.
Return Value
A Promise that will resolve when the configuration of the new model has finished.
-
Sets the model to be customised.
The options map supports the following keys:
variant - The variant of the model.
parts - The initial parts of the model.
country - The country where the model will be sold.
currency - The currency that should be used to calculate the price.
locale - The locale to be used by default when localizing values.
flag - A specific attribute of the model.
useDefaults - If the default parts of the model should be used when no initials parts are set.
usePrice - If the price should be automatically retrieved whenever there is a customization change.
Declaration
Objective-C
- (nonnull Promise *)config:(nonnull NSString *)brand model:(nonnull NSString *)model options:(nonnull NSDictionary *)options;
Swift
func config(_ brand: String, model: String, options: [AnyHashable : Any] = [:]) -> Promise
Parameters
brand
The brand of the model.
model
The name of the model.
options
A map with options to configure the Ripe instance.
Return Value
A Promise that will resolve when the configuration of the new model has finished.
-
Sets the model to be customised.
The options map supports the following keys:
variant - The variant of the model.
parts - The initial parts of the model.
country - The country where the model will be sold.
currency - The currency that should be used to calculate the price.
locale - The locale to be used by default when localizing values.
flag - A specific attribute of the model.
useDefaults - If the default parts of the model should be used when no initials parts are set.
usePrice - If the price should be automatically retrieved whenever there is a customization change.
Declaration
Objective-C
- (nonnull Promise *)config:(nonnull NSString *)brand model:(nonnull NSString *)model options:(nonnull NSDictionary *)options callback: (void (^_Nullable)(NSDictionary *_Nullable))callback;
Swift
func config(_ brand: String, model: String, options: [AnyHashable : Any] = [:], callback: (([AnyHashable : Any]?) -> Void)? = nil) -> Promise
Parameters
brand
The brand of the model.
model
The name of the model.
options
A map with options to configure the Ripe instance.
callback
A callback that will be called when the configuration of the new model has finished.
Return Value
A Promise that will resolve when the configuration of the new model has finished.
-
Changes the customization of a part.
Declaration
Objective-C
- (void)setPart:(nonnull NSString *)part material:(NSString *_Nullable)material color:(NSString *_Nullable)color;
Swift
func setPart(_ part: String, material: String?, color: String?)
Parameters
part
The part to be changed.
material
The material to change to.
color
The color to change to.
-
Changes the customization of a part.
Declaration
Objective-C
- (void)setPart:(nonnull NSString *)part material:(NSString *_Nullable)material color:(NSString *_Nullable)color noEvents:(BOOL)noEvents;
Swift
func setPart(_ part: String, material: String?, color: String?, noEvents: Bool)
Parameters
part
The part to be changed.
material
The material to change to.
color
The color to change to.
noEvents
If the parts events shouldn’t be triggered (defaults
False
). -
Changes the customization of a part.
Declaration
Objective-C
- (void)setPart:(nonnull NSString *)part material:(NSString *_Nullable)material color:(NSString *_Nullable)color noEvents:(BOOL)noEvents options:(nonnull NSDictionary *)options;
Swift
func setPart(_ part: String, material: String?, color: String?, noEvents: Bool, options: [AnyHashable : Any] = [:])
Parameters
part
The part to be changed.
material
The material to change to.
color
The color to change to.
noEvents
If the parts events shouldn’t be triggered (defaults
False
).options
A map with options to configure the operation (for internal use).
-
Allows changing the customization of a set of parts in bulk.
Declaration
Objective-C
- (void)setParts:(nonnull NSDictionary *)parts noEvents:(BOOL)noEvents;
Swift
func setParts(_ parts: [AnyHashable : Any], noEvents: Bool)
Parameters
parts
A NSDictionary with a set of parts to be changed.
noEvents
If the parts events shouldn’t be triggered (defaults
False
). -
Allows changing the customization of a set of parts in bulk.
Declaration
Objective-C
- (void)setParts:(nonnull NSDictionary *)parts noEvents:(BOOL)noEvents options:(nonnull NSDictionary *)options;
Swift
func setParts(_ parts: [AnyHashable : Any], noEvents: Bool, options: [AnyHashable : Any] = [:])
Parameters
parts
A NSDictionary with a set of parts to be changed.
noEvents
If the parts events shouldn’t be triggered (defaults
False
).options
A map with options to configure the operation (for internal use).
-
Allows changing the customization of a set of parts in bulk.
Declaration
Objective-C
- (void)setPartsList:(nonnull NSArray *)partsList;
Swift
func setPartsList(_ partsList: [Any])
Parameters
partsList
A NSArray with a set of parts to be changed.
-
Allows changing the customization of a set of parts in bulk.
Declaration
Objective-C
- (void)setPartsList:(nonnull NSArray *)partsList noEvents:(BOOL)noEvents;
Swift
func setPartsList(_ partsList: [Any], noEvents: Bool)
Parameters
partsList
A NSArray with a set of parts in triplet form to be changed.
noEvents
If the parts events shouldn’t be triggered (defaults
False
). -
Allows changing the customization of a set of parts in bulk.
Declaration
Objective-C
- (void)setPartsList:(nonnull NSArray *)partsList noEvents:(BOOL)noEvents options:(nonnull NSDictionary *)options;
Swift
func setPartsList(_ partsList: [Any], noEvents: Bool, options: [AnyHashable : Any] = [:])
Parameters
partsList
A NSArray with a set of parts in triplet form to be changed.
noEvents
If the parts events shouldn’t be triggered (defaults
False
).options
A map with options to configure the operation (for internal use).
-
Changes the personalization of the model.
Declaration
Objective-C
- (void)setInitials:(nonnull NSString *)initials engraving:(nonnull NSString *)engraving;
Swift
func setInitials(_ initials: String, engraving: String)
Parameters
initials
The initials to be set.
engraving
The engraving to be set.
-
Changes the personalization of the model.
Declaration
Objective-C
- (void)setInitials:(nonnull NSString *)initials engraving:(nonnull NSString *)engraving noUpdate:(BOOL)noUpdate;
Swift
func setInitials(_ initials: String, engraving: String, noUpdate: Bool)
Parameters
initials
The initials to be set.
engraving
The engraving to be set.
noUpdate
If the update operation shouldn’t be triggered (defaults
False
). -
Binds an
Interactable
to this Ripe instance.Declaration
Objective-C
- (nonnull Interactable *)bindInteractable:(nonnull Interactable *)interactable;
Swift
func bindInteractable(_ interactable: Interactable) -> Interactable
Parameters
interactable
The
Interactable
instance to be bound to the Ripe instance.Return Value
The
Interactable
instance created. -
Binds an
Image
to this Ripe instance.Declaration
Objective-C
- (nonnull Image *)bindImage:(nonnull UIImageView *)imageView options:(nonnull NSDictionary *)options;
Swift
func bindImage(_ imageView: UIImageView, options: [AnyHashable : Any] = [:]) -> Image
Parameters
imageView
The
UIImageView
to be used by the Ripe instance.options
A map with options to configure the Image instance.
Return Value
The
Image
instance created. -
Unbinds an
Interactable
from this Ripe instance.Declaration
Objective-C
- (void)unbindInteractable:(nonnull Interactable *)interactable;
Swift
func unbindInteractable(_ interactable: Interactable)
Parameters
interactable
The
Interactable
instance to be unbound. -
Selects a part of the model. Triggers a
selected_part
event with the part.Declaration
Objective-C
- (void)selectPart:(nonnull NSString *)part;
Swift
func selectPart(_ part: String)
Parameters
part
The name of the part to be selected.
-
Selects a part of the model. Triggers a
selected_part
event with the part.Declaration
Objective-C
- (void)selectPart:(nonnull NSString *)part options:(nonnull NSDictionary *)options;
Swift
func selectPart(_ part: String, options: [AnyHashable : Any] = [:])
Parameters
part
The name of the part to be selected.
options
A map with options to configure the operation.
-
Deselects a part of the model. Triggers a
deselected_part
event with the part.Declaration
Objective-C
- (void)deselectPart:(nonnull NSString *)part;
Swift
func deselectPart(_ part: String)
Parameters
part
The name of the part to be selected.
-
Deselects a part of the model. Triggers a
deselected_part
event with the part.Declaration
Objective-C
- (void)deselectPart:(nonnull NSString *)part options:(nonnull NSDictionary *)options;
Swift
func deselectPart(_ part: String, options: [AnyHashable : Any] = [:])
Parameters
part
The name of the part to be selected.
options
A map with options to configure the operation.
-
Reverses the last change to the parts. It is possible
to undo all the changes done from the initial state.
Declaration
Objective-C
- (void)undo;
Swift
func undo()
-
Reapplies the last change to the parts that was undone.
Notice that if there’s a change when the history pointer
is in the middle of the stack the complete stack forward
is removed (history re-written).
Declaration
Objective-C
- (void)redo;
Swift
func redo()
-
Indicates if there are part changes to undo.
current parts history stack.
Declaration
Objective-C
- (BOOL)canUndo;
Swift
func canUndo() -> Bool
Return Value
If there are changes to reverse in the
-
Indicates if there are part changes to redo.
in the history stack.
Declaration
Objective-C
- (BOOL)canRedo;
Swift
func canRedo() -> Bool
Return Value
If there are changes to reapply pending
-
Triggers the update of the children so that they represent the current state of the model.
Declaration
Objective-C
- (void)update;
Swift
func update()
-
Triggers the update of the children so that they represent the current state of the model.
Declaration
Objective-C
- (void)update:(nonnull NSDictionary *)state;
Swift
func update(_ state: [AnyHashable : Any])
Parameters
state
A map with the current customization and personalization.