SCPCartBuilder

Objective-C


@interface SCPCartBuilder : SCPBuilder <SCPCart *>

Swift

class CartBuilder : SCPBuilder<Cart>

A builder class for SCPCart objects.

  • Initializes a new instance of the SCPCartBuilder class with the provided currency.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithCurrency:(nonnull NSString *)currency;

    Swift

    init(currency: String)

    Parameters

    currency

    The currency of the cart. This is a required attribute of the cart and cannot be nil.

  • Note

    This is a required attribute of the cart and cannot be nil.

    Declaration

    Objective-C

    - (nonnull SCPCartBuilder *)setCurrency:(nonnull NSString *)currency;

    Swift

    func setCurrency(_ currency: String) -> CartBuilder

    Return Value

    self for convenience with method chaining.

  • Note

    If not set, defaults to 0.

    Declaration

    Objective-C

    - (nonnull SCPCartBuilder *)setTax:(NSInteger)tax;

    Swift

    func setTax(_ tax: Int) -> CartBuilder

    Return Value

    self for convenience with method chaining.

  • Note

    If not set, defaults to 0.

    Declaration

    Objective-C

    - (nonnull SCPCartBuilder *)setTotal:(NSInteger)total;

    Swift

    func setTotal(_ total: Int) -> CartBuilder

    Return Value

    self for convenience with method chaining.

  • Note

    If not set, defaults to an empty array.

    Declaration

    Objective-C

    - (nonnull SCPCartBuilder *)setLineItems:
        (nonnull NSArray<SCPCartLineItem *> *)lineItems;

    Swift

    func setLineItems(_ lineItems: [CartLineItem]) -> CartBuilder

    Return Value

    self for convenience with method chaining.

  • Unavailable

    Use initWithCurrency.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Unavailable

    Use initWithCurrency.

    Declaration

    Objective-C

    + (nonnull instancetype)new;