VoucherCreationViewControllerDelegate
@protocol VoucherCreationViewControllerDelegate <NSObject>
The ‘VoucherCreationViewControllerDelegate’ is the object responsible for supplying additional screens needed for the creation of a Voucher
.
Screens include login screen, proceed screen, and customized personalization screens.
-
This delegate callback occurs when the user wants to proceed with their
Voucher
but is not currently logged in. Perform a login or prompt the user to login during this callback and then execute the completion block.Declaration
Objective-C
- (void)createViewController: (nonnull VoucherCreationViewController *)viewController needsLoginWithCompletion:(nonnull void (^)(NSError *_Nonnull))completion;
Swift
func createViewController(_ viewController: VoucherCreationViewController, needsLoginWithCompletion completion: @escaping (Error) -> Void)
Parameters
viewController
- The current
VoucherCreationViewController
being actioned on.completion
- Block containing additional tasks to be executed upon logging in. Pass in nil if login was successful, the corresponding
NSError
if login has failed. -
This delegate callback occurs when the user has completed their actions on the
VoucherCreationViewController
and wants to proceed with sending their voucher.Declaration
Objective-C
- (void)createViewController: (nonnull VoucherCreationViewController *)viewController completedWithEnvelopeFrame:(CGRect)envelopeFrame backgroundColor:(nonnull UIColor *)backgroundColor;
Swift
func createViewController(_ viewController: VoucherCreationViewController, completedWithEnvelopeFrame envelopeFrame: CGRect, backgroundColor: UIColor)
Parameters
viewController
- The current
VoucherCreationViewController
being actioned on.envelopeFrame
- The frame of the envelope on the
VoucherCreationViewController
. This frame is intended to be used for any custom transitions or animations of the envelope on the next view controller.backgroundColor
- The current background color of the
VoucherCreationViewController
. It is supplied in the case consistency is required on the next screen. -
This delegate callback occurs when the user wants to add a particular personalization to their voucher.
Declaration
Objective-C
- (nonnull UIViewController<PersonalizationOptionViewControllerProtocol> *) personalizationViewControllerForPersonalizationOption: (nonnull PersonalizationOption *)personalizationOption;
Parameters
personalizationOption
- The personalization option selected by the user.
Return Value
The
UIViewController
presented to the user that allows customization of the desired personalization for the voucher. The view controller must conform to thePersonalizationOptionViewControllerProtocol
protocol. -
This delegate callback occurs when the user completes a personalization option. A
CreationItemImageView
should be returned that represents the element dropped into theEnvelopeView
.Declaration
Objective-C
- (nonnull CreationItemImageView *) creationItemImageViewForPersonalizationOption: (nonnull PersonalizationOption *)personalizationOption personalizedObject:(nonnull id)personalizedObject;
Swift
func creationItemImageView(for personalizationOption: PersonalizationOption, personalizedObject: Any) -> CreationItemImageView
Parameters
personalizationOption
- The personalization option selected by the user.
personalizedObject
- the object returned by the Personalization View Controller.
Return Value
CreationItemImageView - the
CreationItemImageView
to be dropped in theEnvelopeView
. Nil if the default should be used. -
This delegate callback occurs when the
VoucherCreationViewController
needs to be dismissed.Declaration
Objective-C
- (void)createViewControllerCancelled;
Swift
func createViewControllerCancelled()