BPKSnackbar

@interface BPKSnackbar : UIView

A snackbar is a piece of UI displayed at the bottom edge of the window which is useful to show notifications and other feedback on actions the user has just taken.

Users can also take contextual actions for example undoing the change that caused the snackbar to be displayed.

  • Creates a new Snackbar instance and shows it into the screen

    Declaration

    Objective-C

    - (nonnull instancetype)initWithText:(nonnull NSString *)text
                                   title:(NSString *_Nullable)title
                                duration:(BPKSnackbarDuration)duration
                          viewController:(nonnull UIViewController *)viewController
                                delegate:
                                    (id<BPKSnackbarDelegate> _Nullable)delegate;

    Swift

    init(text: String, title: String?, duration: BPKSnackbarDuration, viewController: UIViewController, delegate: BPKSnackbarDelegate?)

    Parameters

    text

    The text displayed next to the title

    title

    The optional content that is displayed in the snackbar’s title

    duration

    time for the snackbar to disappear

    viewController

    viewController where the snackbar will be presented

    delegate

    class that conform the BPKSnackbarProtocol

  • Creates a new Snackbar instance and shows it into the screen

    Declaration

    Objective-C

    - (nonnull instancetype)initWithText:(NSString *_Nullable)text
                                   title:(NSString *_Nullable)title
                                  button:(BPKSnackbarButton *_Nullable)button
                                leftIcon:(UIImage *_Nullable)leftIcon
                                duration:(BPKSnackbarDuration)duration
                          viewController:(nonnull UIViewController *)viewController
                                delegate:
                                    (id<BPKSnackbarDelegate> _Nullable)delegate;

    Swift

    init(text: String?, title: String?, button: BPKSnackbarButton?, leftIcon: UIImage?, duration: BPKSnackbarDuration, viewController: UIViewController, delegate: BPKSnackbarDelegate?)

    Parameters

    text

    The text displayed next to the title

    title

    The optional content that is displayed in the snackbar’s title

    button

    The optional button

    leftIcon

    Left icon displayed before the titleThe text content that is displayed inside the snackbar

    duration

    time for the snackbar to disappear

    viewController

    viewController where the snackbar will be presented

    delegate

    class that conform the BPKSnackbarProtocol

  • Show the snackbar

    Declaration

    Objective-C

    - (void)show;

    Swift

    func show()
  • Dismiss the snackbar

    Declaration

    Objective-C

    - (void)dismiss;

    Swift

    func dismiss()