VouchrActionSheetViewController

@interface VouchrActionSheetViewController : UIViewController

VouchrActionSheetViewController is a custom action sheet used by the SDK. It works similarly to a UIAlertController with style UIAlertControllerStyleActionSheet. Each action sheet item is an action in the controller. If there are too many actions to fit on screen, the actions will become scrollable. A cancel action is automatically added.

  • Action sheet items the VouchrActionSheetViewController uses. The view controller lays out action items based on this array.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable)
        NSArray<VouchrActionSheetItem *> *actionSheetItems;

    Swift

    var actionSheetItems: [VouchrActionSheetItem]? { get }
  • Delegate object for VouchrActionSheetViewController.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable)
        id<VouchrActionSheetViewControllerDelegate>
            delegate;

    Swift

    weak var delegate: VouchrActionSheetViewControllerDelegate? { get set }
  • Default initializer for VouchrActionSheetViewController.

    Declaration

    Objective-C

    + (nonnull instancetype)
    vouchrActionSheetViewControllerWithTitle:(nonnull NSString *)title
                            actionSheetItems:
                                (nullable NSArray<VouchrActionSheetItem *> *)
                                    actionSheetItems
                                 vouchrTheme:(nullable VouchrTheme *)vouchrTheme;

    Swift

    convenience init(title: String, actionSheetItems: [VouchrActionSheetItem]?, vouchrTheme: VouchrTheme?)

    Parameters

    title

    - The title that shows at the top of the Action sheet

    actionSheetItems

    - A list of all items shown in the action sheet

    vouchrTheme

    - the theme manager used to theme the Action sheet properly

    Return Value

    instance of VouchrActionSheetViewController

  • Presents the VouchrActionSheetViewController on a view controller with a custom slide / fade in animation

    Declaration

    Objective-C

    - (void)showOnViewController:(nonnull UIViewController *)viewController
                    onCompletion:(nullable void (^)(void))onCompletion;

    Swift

    func show(on viewController: UIViewController, onCompletion: (() -> Void)? = nil)

    Parameters

    viewController

    - the view controller the action sheet should be added to

    onCompletion

    - completion block that is called when the animation is completed

  • Dismisses the VouchrActionSheetViewController with custom slide / fade out animation. This method is automatically called when a user selects an item or hits the cancel action. This only needs to be called if you want to cancel the action sheet seperately from the user picking an action.

    Declaration

    Objective-C

    - (void)dismissWithCompletion:(nullable void (^)(void))onCompletion;

    Swift

    func dismiss(completion onCompletion: (() -> Void)? = nil)

    Parameters

    onCompletion

    - completion block that is called when the animation is completed