Class
Snackbar
public final class Snackbar
Snackbars inform users of a process that an app has performed or will perform.
They appear temporarily, towards the bottom of the screen. They shouldn’t interrupt the user experience, and they don’t require user input to disappear.
Methods
show(message:duration:style:presentationContext:buttonTitle:buttonAction:)
public static func show(message: String,
duration: BannerDuration = .short,
style: BannerStyle = .default,
presentationContext: SnackbarPresentationContext = .automatic,
buttonTitle: String? = nil,
buttonAction: ((UIButton) -> Void)? = nil)
Displays the Snackbar.
Parameters
Name | Type | Description |
---|---|---|
message | String |
The message to display. |
duration | BannerDuration |
The duration the snackbar stays on screen. |
style | BannerStyle |
The Style to display the snackbar in. |
presentationContext | SnackbarPresentationContext |
The presentation context to display in. Defaults to .automatic. You should only change this in cases where automatic has a hard time displaying the snackbar correctly, e.g MessagesViewController. |
buttonTitle | String? |
The button title if any. Leave as nil if you don't want a button to be displayed. |
buttonAction | ((UIButton) -> Void)? |
The closure that will be called when the button is tapped. Defaults to nil. |