The Feedback view will be in charge of rendering different types of feedbacks. Its content is customisable while the appearance is automatically configured per brand based on the selected feedback style. Background color, icon, animations, fonts and colors are predefined and can't be changed.
Multiline strings that will be positioned one below the other. If the content is large enough the view will scroll.
There are three fixed styles available: .success
, .informative
and .error
. There's one custom style .feedback(image)
that can be used to provide an icon that will be used instead of the fixed ones:
Success | Informative | Error | Feedback |
---|---|---|---|
For the primary action, there are three different options:
- Button:
FeedbackPrimaryAction.button(title: "Primary button", completion: { ... })
- Retry Button:
FeedbackPrimaryAction.retryButton(title: "Primary button", loadingTitle: nil, retryCompletion: { completionHanlder in ... })
- No button:
FeedbackPrimaryAction.none
Button | Retry Button |
---|---|
completionHandler
closure when the async retry task is finished.
retryCompletion: { completionHandler in
// Do async retry task
DispatchQueue.main.async {
completionHandler()
}
}
For the secondary action, there are three different options:
- Button:
FeedbackSecondaryAction.button(title: "Secondary button", completion: { ... })
- Link:
FeedbackSecondaryAction.link(title: "Secondary button", completion: { ... })
- No button:
FeedbackSecondaryAction.none
Button | Link | None |
---|---|---|
An extra UIView
can be provided to be placed below the subtitle. It will keep the same margins than the view above so no constraints should be required in order to properly align it with the rest of the content.
Import CommonUIKit
and create a FeedbackConfiguration
with the required parameters. For example, a configuration for a success feedback with a link secondary action and an extra view:
FeedbackConfiguration(style: .success,
title: "Title",
subtitle: "Subtitle",
primaryAction: .button(title: "Primary Action", completion:{ ... }),
secondaryAction: .link(title: "Secondary Action", completion:{ ... }),
extraContent: CustomExtraUIView())
The configuration can be simplified if only the required parameters are provided, by default there's no secondary action and extra content view:
FeedbackConfiguration(style: .success,
title: "Title",
subtitle: "Subtitle",
primaryAction: .button(title: "Primary Action", completion:{ ... }))
Once the configuration is created, use the feedbackNavigator
available in the CommonUIKitAssembly
to push
or present
the feedback view:
feedbackNavigator.pushFeedback(configuration: configuration)
feedbackNavigator.presentFeedback(configuration: configuration)